Since Rails 5, Rails introduced something call Framework Defaults ✨.
Which will allow you run your Rails app in newer version while
keeping your application on older configurations. To make upgrade your Rails easier. You can delay opt-in to new framework default configurations later.
When you bump the Rails version, run the recommended update task bin/rails app:update
, will add a a load_defaults
line to your config/application.rb
:
module JuanitoFatas
class Application < Rails::Application
config.load_defaults 6.0
end
end
And Rails will generate a file depends on which Rails version you upgrade to:
- If you upgrade to Rails 5.0:
new_framework_defaults.rb
- If you upgrade to Rails 5.1:
new_framework_defaults_5_1.rb
- If you upgrade to Rails 5.2:
new_framework_defaults_5_2.rb
- If you upgrade to Rails 6.0:
new_framework_defaults_6_0.rb
- If you upgrade to Rails 6.1:
new_framework_defaults_6_1.rb
- If you upgrade to Rails 7.0:
new_framework_defaults_7_0.rb
- If you upgrade to Rails 7.1:
new_framework_defaults_7_1.rb
- If you upgrade to Rails 7.2:
new_framework_defaults_7_2.rb
- If you upgrade to Rails 8.0:
new_framework_defaults_8_0.rb
These files will contain all the defaults configurations for its respective Rails version. You can find what the new defaults are for each Rails version at: lib/rails/application/configuration.rb and these framework defaults file turn them off by default so it does not break your app.
It is possible you have an application on Rails 7.0 and load 6.0 defaults. You can find what does each configuration do at Configuring Rails Applications Guide.
You can study the default and change each configuration to what makes sense for your application. One PR at a time. And delete the framework defaults file once you’ve flipped all configurations.