Allows you to split your ActiveRecord find calls and your eager loading decisions.
Installation
gem install preload
Usage
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 ...
Contributing
- 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
Releasing a new version
A new version is published to RubyGems.org every time a change to version.rb
is pushed to the main
branch.
In short, follow these steps:
- Update
version.rb
, - update version in all
Gemfile.lock
files, - merge this change into
main
, and - look at the action for output.
To create a pre-release from a non-main branch:
- change the version in
version.rb
to something like1.2.0.pre.1
or2.0.0.beta.2
, - push this change to your branch,
- go to Actions → “Publish to RubyGems.org” on GitHub,
- click the “Run workflow” button,
- pick your branch from a dropdown.