On Sep 22, 9:16 pm, Ben Johnson <[EMAIL PROTECTED]>
wrote:
> Thanks for your help. I am still somewhat confused though.
>
> So is the general rule of thumb to use joins on belongs to relationships
> and include on has_many. It looks as if joins returns flawed results is
> used on a has_many relationship. Is this correct?
>
No. Use :joins when you want a join. Use include when you want to
avoid the n+1 problem (ie you want rails to load and populate the
associations).

Fred
> I would prefer to avoid include because it is so much slower, but joins
> doesnt seem to return the correct records.
>
> Thanks.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to