How to Update Ruby, Rails, and Spree: Some Pointers Please? - ruby-on-rails

I'm looking into updating this enormous web site. Its huge. It uses Ruby 1.9.3-p448, Rails 3.2.17, and Spree 2.0.0. I'd love to push it to Ruby 2.1.1, Rails 4.1-stable, and Spree 2.1.0.
First things first:
I went to the gemfile and on line 2 wrote ruby '2.1.1'. This is to do number 1: upgrade the language itself. In the terminal I did the usual bundle and got an error. Discovered the debugger gem doesn't work in 2.x territory. Highlighted it. Pushed delete. Chuckled. Ran bundle. Smiled of delight as it was so nice to see everything work with such a complex system.
Then I ran bundle exec rake db:test:prepare...
First error:
rake aborted!
cannot load such file -- iconv
/Users/benamorgan/.rvm/gems/ruby-2.1.1/gems/polyglot-0.3.4/lib/polyglot.rb:65:in `require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/gems/polyglot-0.3.4/lib/polyglot.rb:65:in `require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:251:in `block in require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:251:in `require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/gems/csv_builder-2.1.0/lib/csv_builder.rb:14:in `<top (required)>'
/Users/benamorgan/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `each'
/Users/benamorgan/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:72:in `block in require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `each'
/Users/benamorgan/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler/runtime.rb:61:in `require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1#global/gems/bundler-1.5.3/lib/bundler.rb:131:in `require'
/Users/benamorgan/Sites/not_getting_name_of_site/config/application.rb:7:in `<top (required)>'
/Users/benamorgan/Sites/not_getting_name_of_site/Rakefile:5:in `require'
/Users/benamorgan/Sites/not_getting_name_of_site/Rakefile:5:in `<top (required)>'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)
OK... In the gemfile...
gem 'iconv'
run bundle exec rake db:test:prepare again after a bundle:
Digest::Digest is deprecated; use Digest
rake aborted!
no implicit conversion of nil into String
/Users/benamorgan/.rvm/gems/ruby-2.1.1/gems/mysql2-0.3.13/lib/mysql2/client.rb:58:in `connect'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/gems/mysql2-0.3.13/lib/mysql2/client.rb:58:in `initialize'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/model_schema.rb:224:in `table_exists?'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activerecord/lib/active_record/attribute_methods.rb:122:in `attribute_method?'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/spree-9c3a61024d8c/core/lib/spree/core/delegate_belongs_to.rb:40:in `block in delegate_belongs_to'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/spree-9c3a61024d8c/core/lib/spree/core/delegate_belongs_to.rb:39:in `each'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/spree-9c3a61024d8c/core/lib/spree/core/delegate_belongs_to.rb:39:in `delegate_belongs_to'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/spree-9c3a61024d8c/core/app/models/spree/gateway.rb:3:in `<class:Gateway>'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/spree-9c3a61024d8c/core/app/models/spree/gateway.rb:2:in `<module:Spree>'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/spree-9c3a61024d8c/core/app/models/spree/gateway.rb:1:in `<top (required)>'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/gems/zeus-0.13.3/lib/zeus/load_tracking.rb:50:in `load'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/gems/zeus-0.13.3/lib/zeus/load_tracking.rb:50:in `load'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:469:in `block in load_file'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:639:in `new_constants_in'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:468:in `load_file'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:353:in `require_or_load'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:502:in `load_missing_constant'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:192:in `block in const_missing'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:190:in `each'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:190:in `const_missing'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/spree-9c3a61024d8c/core/lib/spree/core/engine.rb:59:in `block in <class:Engine>'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/railties/lib/rails/initializable.rb:30:in `instance_exec'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/railties/lib/rails/initializable.rb:30:in `run'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/railties/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/railties/lib/rails/initializable.rb:54:in `each'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/railties/lib/rails/initializable.rb:54:in `run_initializers'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/railties/lib/rails/application.rb:136:in `initialize!'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/railties/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/benamorgan/Sites/not_getting_name_of_site/config/environment.rb:5:in `<top (required)>'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/gems/polyglot-0.3.4/lib/polyglot.rb:65:in `require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/gems/polyglot-0.3.4/lib/polyglot.rb:65:in `require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:251:in `block in require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:236:in `load_dependency'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/activesupport/lib/active_support/dependencies.rb:251:in `require'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/railties/lib/rails/application.rb:103:in `require_environment!'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bundler/gems/rails-a3bda3846737/railties/lib/rails/application.rb:305:in `block (2 levels) in initialize_tasks'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
/Users/benamorgan/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:test:prepare => db:abort_if_pending_migrations => environment
(See full trace by running task with --trace)
My question here really isn't how do I fix this or why is it all breaking, but do you have any pointers? How do I find out where Digest::Digest is coming from? We aren't using it in the site, therefore its a gem problem. I'm probably going to have to deal with more of those "deprecation" warnings, so before I blow hours and hours on it, I just need to know if anyone else has had to go through anything of what I'm attempting right now.
Horror stories much appreciated.

I don't think Digest is the cause of your problems. It seems that MySQL can't connect to your database correctly. Are you sure that your config/database.yml settings are correct for your current environment?
I don't know for certain, but if the error is pointing directly at this line then it's my best guess that you've got your database mis-configured within config/database.yml.

I've found that I get the same error message whenever my installed version of csv_builder is out of sync with my installed version of MRI.
I see you're using MRI 2.1.1 and csv_builder 2.1.0. You can possibly fix this issue by removing the iconv gem, and bumping your version of csv_builder so that it matches the version of MRI:
# Gemfile
gem 'csv_builder', '2.1.1'
> bundle update csv_builder
> bundle exec rake tes
Worked for me... YMMV etc

Related

Missing `secret_key_base` for 'production' environment but it is in my encrypted file

I'm working on a 6.0.2 rails app and everything seems to work fine in development (I can create the database and run the app on a localhost). However, I'm stuck trying to make it work in production. I have a master.key file containing my key and a credentials.yml.enc file containing: secret_key_base: 123... (with my real key of course).
With this, I'm trying to run RAILS_ENV=production rails db:setup but it always fails with the following error:
rails aborted!
ArgumentError: Missing `secret_key_base` for 'production' environment, set this string with `rails credentials:edit`
/Users/victor/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/application.rb:580:in `validate_secret_key_base'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/application.rb:423:in `secret_key_base'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/devise-4.7.1/lib/devise/secret_key_finder.rb:24:in `key_exists?'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/devise-4.7.1/lib/devise/secret_key_finder.rb:16:in `find'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/devise-4.7.1/lib/devise/rails.rb:37:in `block in <class:Engine>'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/initializable.rb:32:in `instance_exec'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/initializable.rb:32:in `run'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/initializable.rb:61:in `block in run_initializers'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/initializable.rb:60:in `run_initializers'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/application.rb:363:in `initialize!'
/Users/victor/Documents/SaaS projects/myblog/config/environment.rb:5:in `<main>'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `block in require'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:291:in `load_dependency'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `require'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/application.rb:339:in `require_environment!'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/application.rb:515:in `block in run_tasks_blocks'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/command.rb:48:in `invoke'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/railties-6.0.2.1/lib/rails/commands.rb:18:in `<main>'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `block in require'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:291:in `load_dependency'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.2.1/lib/active_support/dependencies.rb:325:in `require'
/Users/victor/Documents/SaaS projects/myblog/bin/rails:9:in `<top (required)>'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
/Users/victor/.rvm/gems/ruby-2.6.3/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
/Users/victor/Documents/SaaS projects/myblog/bin/spring:15:in `require'
/Users/victor/Documents/SaaS projects/myblog/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => db:setup => db:schema:load_if_ruby => db:create => db:load_config => environment
(See full trace by running task with --trace)
I'm really confused here, because it says that there's no secret_key_base but it is defined in my credentials.yml.enc (it's the only thing in there!)
I looked at a bunch of other stackoverflow questions and saw that this problem is usually due to the old way Rails has to handle encrypted files (but I'm in 6.0.2 so this shouldn't be an issue...). The only other answer I found suggested to delete the master.key and credentials.yml.enc and create new ones with rails credentials:edit, which I did, but it didn't change anything.
Specify the environment along like should help with this problem.
rails credentials:edit --environment production

Rails Application appear Errors after upgrade to Rails 5.1.1

After I upgrade my Rails app from 5.0.2 to 5.1.1, errors appear like that:
No such middleware to insert after: "ActionDispatch::DebugExceptions"
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.1/lib/action_dispatch/middleware/stack.rb:106:in `assert_index'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.1/lib/action_dispatch/middleware/stack.rb:80:in `insert_after'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/configuration.rb:69:in `block in merge_into'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/configuration.rb:68:in `each'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/configuration.rb:68:in `merge_into'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/engine.rb:507:in `block in app'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/engine.rb:504:in `synchronize'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/engine.rb:504:in `app'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/application/finisher.rb:45:in `block in <module:Finisher>'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/initializable.rb:30:in `instance_exec'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/initializable.rb:30:in `run'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/initializable.rb:59:in `block in run_initializers'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/initializable.rb:58:in `run_initializers'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/application.rb:353:in `initialize!'
/Users/thiensubs/Documents/super-control/config/environment.rb:5:in `<top (required)>'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `require'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `block in require'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:258:in `load_dependency'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:292:in `require'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/application.rb:329:in `require_environment!'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/application.rb:445:in `block in run_tasks_blocks'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/commands/rake/rake_command.rb:21:in `block in perform'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/command.rb:46:in `invoke'
/Users/thiensubs/.rvm/gems/ruby-2.4.1/gems/railties-5.1.1/lib/rails/commands.rb:16:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => middleware => environment
(See full trace by running task with --trace)
My ruby version is: 2.4.1
Older Rails version is: 5.0.2
My lasted version is: 5.1.1
Any body can help me with that?
I ran into the same problem and after grepping insert_after method in my gem folders, it was an outdated airbrake gem which causes the problem.
Relax the version in Gemfile and bundle update airbrake seems to fix it.

Error with rake db:migrate with rails 4.1 on Mavericks

I just upgraded my OS X from 10.7.5 to 10.9.3.
I've done the following:
- Upgraded ruby to 2.1.2 (and using it)
- bundle install succeeded
- installed postgres, server running.
$rails server -p 5000
works (the server runs)
However, when I do
$rake db:migrate
It gives me the following error:
rake aborted!
NameError: uninitialized constant AbstractController::Error
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.1/lib/abstract_controller/rendering.rb:8:in `<module:AbstractController>'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/actionpack-4.1.1/lib/abstract_controller/rendering.rb:7:in `<top (required)>'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/haml-3.1.6/lib/haml/helpers/rails_323_textarea_fix.rb:1:in `<top (required)>'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/haml-3.1.6/lib/haml/helpers/action_view_mods.rb:260:in `<top (required)>'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/haml-3.1.6/lib/haml/template.rb:3:in `<top (required)>'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/haml-3.1.6/lib/haml.rb:41:in `block in init_rails'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/haml-3.1.6/lib/haml.rb:41:in `each'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/haml-3.1.6/lib/haml.rb:41:in `init_rails'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/haml-3.1.6/lib/haml/railtie.rb:16:in `block (2 levels) in <top (required)>'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/lazy_load_hooks.rb:27:in `each'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/haml-3.1.6/lib/haml/railtie.rb:15:in `block in <top (required)>'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/lazy_load_hooks.rb:44:in `each'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.1/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application/bootstrap.rb:76:in `block in <module:Bootstrap>'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/initializable.rb:30:in `instance_exec'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/initializable.rb:30:in `run'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/initializable.rb:55:in `block in run_initializers'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/initializable.rb:54:in `run_initializers'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application.rb:288:in `initialize!'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/railtie.rb:194:in `public_send'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/railtie.rb:194:in `method_missing'
/Users/ppd/Academics/Research/git/teapot/config/environment.rb:5:in `<top (required)>'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application.rb:264:in `require_environment!'
/Users/ppd/.rvm/gems/ruby-2.1.2/gems/railties-4.1.1/lib/rails/application.rb:367:in `block in run_tasks_blocks'
/Users/ppd/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
/Users/ppd/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
I can't seem to find anything on this on google/SO. I'd really appreciate help with it!
I haven't figured out the details of it, but apparently Haml is the culprit here.
Remove gem 'haml-rails' from your Gemfile if you have it, and replace it with:
gem 'haml', '~> 4.0.0'
Then run bundle update and boot up the Rails server again.

Cannot load Rails app fetched from GitHub; rake, rails server not working

I cloned an app folder from a GitHub repository, and after bundle install the gems, I tried to use the rake db:reset and rake db:migrate commands, neither worked, and here is my error message:
>[app_folder]rake db:reset
rake aborted!
Could not load database configuration. No such file - /Users/harry/Dropbox/apps/app_folder/config/database.yml
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/application/configuration.rb:110:in `database_configuration'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activerecord-4.0.0/lib/active_record/railtie.rb:174:in `block (2 levels) in <class:Railtie>'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:27:in `each'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activerecord-4.0.0/lib/active_record/railtie.rb:173:in `block in <class:Railtie>'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/harry/Dropbox/apps/app_folder/config/environment.rb:5:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/application.rb:249:in `block in run_tasks_blocks'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.0.0-p353#railstutorial_rails_4_0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:reset => environment
(See full trace by running task with --trace)
[app_folder]
I get similar errors when I try to run rails server or rails console. Would really appreciate any help!! Thanks a lot!
Usually rails apps have config/database.yml.example, copy this file to config/database.yml and overwrite database connection settings if necessary.

Operation not permitted when trying to run god on RHEL5

When i am trying to start god on RHEL5 box, am getting the following error. I have also installed libevent and libevent-devel packages, but the error persists. Does any one have any idea?
I patched the ruby file https://github.com/mojombo/god/blob/master/lib/god/event_handler.rb to include puts $!.message and puts $!.backtrace in the rescue Exception block of the self.load method to get the following backtrace.
Operation not permitted
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/event_handlers/netlink_handler.rb:1:in `require'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/event_handlers/netlink_handler.rb:1:in `<top (required)>'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/event_handler.rb:22:in `require'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/event_handler.rb:22:in `load'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/cli/run.rb:54:in `default_run'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/cli/run.rb:100:in `block in run_daemonized'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/cli/run.rb:91:in `fork'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/cli/run.rb:91:in `run_daemonized'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/cli/run.rb:21:in `dispatch'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/cli/run.rb:8:in `initialize'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/bin/god:122:in `new'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/bin/god:122:in `<top (required)>'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/bin/god:19:in `load'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/bin/god:19:in `<main>'
I also see the following lines in the god log file
***********************************************************************
*
* Event conditions are not available for your installation of god.
* You may still use and write custom conditions using the poll system
*
***********************************************************************
Also, below is the output from IRB
[rails#x-rws1 current]$ RAILS_ENV=staging script/console
Loading staging environment (Rails 2.3.11)
irb: warn: can't alias exit from irb_exit.
ruby-1.9.2-p180 :001 > God::EventHandler.load
Operation not permitted
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:184:in `require'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/event_handlers/netlink_handler.rb:1:in `<top (required)>'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:184:in `require'
/home/rails/public_html/my_app/shared/bundle/ruby/1.9.1/gems/god-0.11.0/lib/god/event_handler.rb:22:in `load'
(irb):1:in `irb_binding'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/context.rb:254:in `evaluate'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:159:in `block (2 levels) in eval_input'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:273:in `signal_status'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:156:in `block in eval_input'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/ruby-lex.rb:243:in `block (2 levels) in each_top_level_statement'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `loop'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `block in each_top_level_statement'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `catch'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `each_top_level_statement'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:155:in `eval_input'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:70:in `block in start'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:69:in `catch'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:69:in `start'
/home/rails/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `<main>'
=> false
I realized that god can only be started from a root user because of the netlink_handler_ext dependency. So even if you install the god gem as a non sudo user, you still have to use sudo to start god. So, I finally had to assign root privileges to the rails user and use rvmsudo to startup god.

Resources