Reputation: 5800
In Rails 3, you do like...
User.select(...).include(...).order(...)
However, if you select only 1 record, how do you do that?
User.find(10).include(:pictures) doesn't seem to work.
Should I use User.find(10, :include => [:pictures]) ?
Thanks.
Sam
Upvotes: 0
Views: 553
Reputation: 7072
Yes your User.find(10, :include=>:pictures])
example should work fine. You can also do User.includes(:pictures).find(10)
.
It doesn't matter too much either way but I'd probably go with the second method since it's more Rails 3ish and less likely to wind up deprecated.
Upvotes: 2