On Jul 14, 3:30 pm, Max Williams <[email protected]> wrote:
> I have a situation where an instance method pulls out a selection from a
> set of associated objects.  Sometimes when this is called the associated
> objects have been eager loaded, in which case it makes most sense to use
> .select to pull the ones i want from the already-loaded collection.
> Other times the associated objects have *not* been eager loaded, and it
> makes most sense to use association.find to get the ones i want.
>
> My question is this:  can i tell if the associated objects have been
> eager loaded already, so i can choose which approach to take?  Or, even
> better, is there a single approach where rails will know whether to load
> them again or not?
>

if it's a collection then foo.bars.loaded?

Fred
> thanks, max
> --
> 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