dimanche 6 septembre 2015

Gem errors when upgrading rails app from 3 to 4, unable to run rails s

I inherited a rails app that I believe was written in rails 3. I am now running rails 4.2.3. When I try to run the app locally (rails s) I get a host of errors related to active record and initializers. I have searched for these errors individually, but nothing I have done so far has worked.

I have added the protected attributes gem as mentioned here http://ift.tt/1FrohRZ

I upgraded the gem file to use rails 4

I have upgraded the gems using bundle upgrade. No luck.

I have sent a message to the original dev and he has no idea why this is happening.

What do I need to do in order to make this app run locally without errors?

This is the errors I get when running rails s in terminal:

Astrids-MacBook-Air% rails s
=> Booting WEBrick
=> Rails 4.2.3 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:

  * development - set it to false
  * test - set it to false (unless you use a tool that preloads your test environment)
  * production - set it to true

Exiting
/Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/dynamic_matchers.rb:26:in `method_missing': undefined method `auto_explain_threshold_in_seconds=' for ActiveRecord::Base:Class (NoMethodError)
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/railtie.rb:108:in `block (3 levels) in <class:Railtie>'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/railtie.rb:107:in `each'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/railtie.rb:107:in `block (2 levels) in <class:Railtie>'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:27:in `each'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.3/lib/active_record/railtie.rb:106:in `block in <class:Railtie>'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `instance_exec'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `run'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
  from /Users/Astrid/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
  from /Users/Astrid/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
  from /Users/Astrid/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
  from /Users/Astrid/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
  from /Users/Astrid/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each'
  from /Users/Astrid/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `call'
  from /Users/Astrid/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
  from /Users/Astrid/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
  from /Users/Astrid/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/initializable.rb:54:in `run_initializers'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/application.rb:352:in `initialize!'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/railtie.rb:194:in `public_send'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/railtie.rb:194:in `method_missing'
  from /Users/Astrid/Documents/Development/Handled/ticketsnap_server/config/environment.rb:5:in `<top (required)>'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
  from /Users/Astrid/Documents/Development/Handled/ticketsnap_server/config.ru:3:in `block in <main>'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
  from /Users/Astrid/Documents/Development/Handled/ticketsnap_server/config.ru:in `new'
  from /Users/Astrid/Documents/Development/Handled/ticketsnap_server/config.ru:in `<main>'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/commands/server.rb:61:in `app'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/commands/server.rb:139:in `log_to_stdout'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/commands/server.rb:78:in `start'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:80:in `block in server'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:75:in `tap'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:75:in `server'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
  from /Users/Astrid/.rvm/gems/ruby-2.2.1/gems/railties-4.2.3/lib/rails/commands.rb:17:in `<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>'

Aucun commentaire:

Enregistrer un commentaire