This blog is part of our Rails 5.2 series.
Rails 5.2 beta 1 was recently released.
If we generate a new Rails app using Rails 5.2, we will see bootsnap gem in the Gemfile. bootsnap helps in reducing the boot time of the app by caching expensive computations.
In a new Rails 5.2 app,
boot.rb will contain following content:
This sets up bootsnap to start in all environments. We can toggle it per environment as required.
This works out of the box and we don’t have do to anything for the new app.
If we are upgrading an older app which already has bootsnap, then we need to make sure that we are using bootsnap >= 1.1.0 because new Rails apps ship with that version constraint.
If the app doesn’t contain the bootsnap gem already then we will need to add it manually
rails app:update task adds the
bootsnap/setup line to
boot.rb regardless of its presence
in the Gemfile.