# Eager Loading

**URL:** <https://www.ruby-forum.com/t/eager-loading/183177>\
**Category:** Rails\
**Created:** [February 9, 2010, 4:00pm UTC](https://www.ruby-forum.com/t/eager-loading/183177 "2010-02-09T16:00:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 9, 2010, 4:00pm UTC](https://www.ruby-forum.com/t/eager-loading/183177/1 "2010-02-09T16:00:46Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 9, 2010, 4:03pm UTC](https://www.ruby-forum.com/t/eager-loading/183177/2 "2010-02-09T16:03:07Z")

</div>

You can set up a default scope:

[http://ryandaigle.com/articles/2008/11/18/what-s-new-in-edge-rails-default-scoping](http://ryandaigle.com/articles/2008/11/18/what-s-new-in-edge-rails-default-scoping)

Mat
