Hi,
While trying out some new associations with dataset procs, I noticed that
joins to a model would return a result as an instance of that model. For
example:
User.join( Role )
=> #<Sequel::SQLite::Dataset: "SELECT * FROM `users` INNER JOIN
`roles`">
User.join( Role ).first.class
=> User
I would expect a hash, as in my mind it's equivalent to
DB[:users].join( DB[:roles] )
=> #<Sequel::SQLite::Dataset: "SELECT * FROM `users` INNER JOIN (SELECT
* FROM `roles`) AS 't1'">
DB[:users].join( DB[:roles] ).first.class
=> Hash
Is there an option to make it return a hash? Otherwise, the extra fields
don't have accessors as they're not defined on the model. I could use
`User.join( Role ).to_hash.first` but that isn't quite the same thing, and
my first thought would be that it added a lot of overhead, especially to
large datasets (but then I was wrong about the hash too! :)
Regards,
Iain
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.