Ran rails app:update and looked at the diff of each changed file
to figure out what to change
Looked at the diff between 5.1.7 and 5.2.4.1 on railsdiff.org
Issues I ran into when running rails c or script/test:
Got an error about manifest.js missing. This was due to Sprockets
being upgraded to 4.x. The fix was to create a manifest.js as shown
in this PR
Many tests failed due to missing associations. This was because
belongs_to by default assumes it's not optional, but in many cases,
we have a model that can belong to one or more other models, but it's
not required. The fix was to add optional: true to the models.
Note that some of the new defaults in 5.2 are not enabled by default.
Once the app is stable in production, they can be turned on one by one
in config/initializers/new_framework_defaults_5_2.rb, and then
in config/application.rb, config.load_defaults can be changed to
5.2.
rails app:update
and looked at the diff of each changed file to figure out what to changeIssues I ran into when running
rails c
orscript/test
:belongs_to
by default assumes it's not optional, but in many cases, we have a model that can belong to one or more other models, but it's not required. The fix was to addoptional: true
to the models.Note that some of the new defaults in 5.2 are not enabled by default. Once the app is stable in production, they can be turned on one by one in
config/initializers/new_framework_defaults_5_2.rb
, and then inconfig/application.rb
,config.load_defaults
can be changed to 5.2.