varvet / godmin

Admin framework for Rails 5+
http://godmin-sandbox.herokuapp.com
MIT License
486 stars 51 forks source link

Run test app under default configuration for active rails version #269

Closed anderscarling closed 2 years ago

dgmstuart commented 2 years ago

@anderscarling I'm not sure what this change is about.

anderscarling commented 2 years ago

@dgmstuart Since something like version 5.1 - Rails has by default shipped with a line like config.load_defaults "5.1" in application.rb. That was added to make updating versions easier, e.g. by allowing people to test the new default settings one by one (and then hopefully bump load_defaults to the latest version once all new settings are tested and applied).

As we have previously had no "load_defaults" line in our dummy application, we effectively ran each newer version of rails with the defaults settings from rails 5.0 - which is not what I would expect a real production application to do.

This change basically make sure to apply the default settings for the currently loaded rails minor version, so we run with (mostly) the same settings as a newly generated app with that version would use. This does not cover everything, as there is probably some changes to the generated settings files as well, but it should get us closer.

The changes to the model files is required because the belongs_to relationships became required by default in rails 6 (I think), but we were not affected by that change as we ran the old default settings