Eager loading outside the find method

Hello,

I am used tO the :include parameter always inside a find method:

@posts = Post.find(:all, :include => [:user])

How can I wire the :include to the relationship outside the find
method?

@posts = Post.find(:all)
@posts…(HERE THE METHOD TO WIRE UP THE USER TO EACH POST)

Thanks

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.

I just want to know if its possible.

On 31 dic, 03:31, elioncho [email protected] wrote:

@posts…(HERE THE METHOD TO WIRE UP THE USER TO EACH POST)

Thanks

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.

I want to reproduce the internals of eager loading.

On 31 dic, 03:45, elioncho [email protected] wrote:

How can I wire the :include to the relationship outside the find
method?

@posts = Post.find(:all)
@posts…(HERE THE METHOD TO WIRE UP THE USER TO EACH POST)

Thanks

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.

On Dec 31, 9:06 am, elioncho [email protected] wrote:

I want to reproduce the internals of eager loading.

If you’re feeling evil you can do something like

Post.send :preload_associations @posts, :user

(This is a protected method - could easily change between releases of
rails)

Fred

Thanks

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.