7

I have just created a new rails app (on the CL, using rails new), I am on 4.2.6, but it seems like before I can do anything to the app that i've hit errors.

first...

/config/environments/development.rb:53:in `block in <top (required)>':
  uninitialized constant ActiveSupport::EventedFileUpdateChecker (NameError)

then once I comment that out...

/config/initializers/new_framework_defaults.rb:15:in `<top (required)>':
  undefined method `to_time_preserves_timezone=' for ActiveSupport:Module (NoMethodError)

and once that is commented out...

 /config/initializers/new_framework_defaults.rb:21:in `<top (required)>':
  undefined method `halt_callback_chains_on_return_false=' for ActiveSupport:Module (NoMethodError)

and lastly...

.gem/ruby/2.2.3/gems/actionmailer-4.2.5/lib/action_mailer/base.rb:569:in `method_missing':
  undefined method `perform_caching=' for ActionMailer::Base:Class (NoMethodError)

everything I can turn up on Google suggests these are Rails 5 related things. I'm not sure how to get around them, or how to create an app that is still specific to 4.2.6.

Andy Waite
  • 10,785
  • 4
  • 33
  • 47
  • 1
    Do you mean you created an app with rails 5 and trying to downgrade it to 4? – Vasfed Jul 04 '16 at 18:54
  • Can you share your project on github? – Saad Jul 04 '16 at 19:34
  • I will suggest try this http://andreapavoni.com/blog/2013/8/a-rails-4-tutorial-application-for-beginners/#.V3t4b3V95CU link and start from the scratch. – shrikant1712 Jul 05 '16 at 09:06
  • [http://stackoverflow.com/questions/379141/specifying-rails-version-to-use-when-creating-a-new-application](http://stackoverflow.com/questions/379141/specifying-rails-version-to-use-when-creating-a-new-application) Try > rails _ 4.2.6 _ new myapp – Peter Jul 07 '16 at 09:46

2 Answers2

5

If still you want to use Rails 5 comment the below line in development.rb file: config.action_mailer.perform_caching = false

And after doing that you may get:
ActionView::Template::Error (couldn't find file 'ation_cable' with type 'application/javascript'

Then remove = from //= require action_cable in your cable.js file.

Mayuresh Srivastava
  • 1,332
  • 17
  • 24
  • This is amazing. How did commenting out that line work. I'm on Rails 4.2.6. It's like [this](https://xkcd.com/979/). – intcreator May 19 '17 at 22:51
2

tl;dr: Re-create your Rails project, providing the specific Rails version.

To elaborate on Peter's answer: often this error occurs because you have a newer version of Rails installed than the one called for in your .railsrc or template.rb.

If this is the case, when you run rails new my_new_app, the newest version is used by default for the earlier steps of the process, but then once the template/railsrc version is installed, latter steps use this version. This causes compatibility issues.

You can verify that this is your problem by comparing the output of rails -v (in the directory where you called rails new) with what's in your .railsrc or template.rb. If they are different, there is an easy fix:

Recreate your Rails app, specifying the same Rails version from your .railsrc or template.rb in the command line call:
rails _4.2.5.1_ new my_new_app

Community
  • 1
  • 1
Scott Schupbach
  • 1,284
  • 9
  • 21