Allows you to split your ActiveRecord find calls and your eager loading decisions.
gem install preload
Now in your controller you don't have to know which associations should be eager loaded because your views need them.
In your controller:
def index @posts = blog.posts.order('created_at DESC') end
in your view:
<% @posts.pre_load(:comments) %> ... render posts and their comments ...
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Added some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request