Project stopped working after re-evaluating Rails version

I originally used rails version 5.1.1, but when I downgraded it to 4.2.7, it started giving me the following error:

`method_missing': undefined method `load_defaults'

      

whenever i try to run "rails s" it shows the above error in the terminal, it is just a new project, i just installed a new project with "rails new" then i changed the rails version in the gem file to

gem 'rails', '~> 4.2.7'

      

after that when i tried to hit "rails s" it started giving me this error.

Any ideas why this is happening?

+3


source to share


1 answer


A Rails application generated with version 5.1.1 includes this line:

# in config/application.rb:12
config.load_defaults 5.1

      

load_defaults

is a method that was introduced in Rails 5 and does not exist in Rails 4.2.x



However, you can't just downgrade Rails (by the way, you usually can't just upgrade). You need to change your application to the structure expected by another version of Rails. RailsDiff is a great resource for seeing the differences between applications generated in different versions of Rails.

You have two options:

  • Accept changes between versions or
  • Rebuild the new app with the correct version.
+4


source







All Articles