You can set up a default scope:
http://ryandaigle.com/articles/2008/11/18/what-s-new-in-edge-rails-default-scoping
Mat
On Tue, Feb 9, 2010 at 09:59, TomRossi7
<tom-5bxIUPmzHicFraO2wh7vUA@public.gmane.org>
wrote:> Is there a way to specify within a model that an association should
> always be loaded. For example, the classic example from the API docs:
>
> Post.find(:all, :include => :author)
>
> What if I ALWAYS wanted the author to be loaded whenever a Post object
> was created? So, in essence, Post.find(:all) would bring back each
> post with the associated author object already loaded.
>
> 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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> 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.
>
>
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
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.