[Rails] Can i eager-load associations onto an already-loaded object?
Let's say that i have a User object in @user, already loaded. I want
to constantly refer to @user.role on a particular page (where User
belongs_to :role), so i want to 'eager load' the role association.
For the sake of argument, let's say i wasn't able to do this in the
normal way (ie with the :include option to a find call) when i loaded
the user out of the database in the first place, but need to do it
subsequent to that. Is that possible?
--
Posted via http://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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home