Rake tasks keep failing - ruby-on-rails

I'm trying to set up my development environment to work with an existing project that's using Mongoid. I've run bundle install and that worked fine, but I'm now trying to set up the database, and I'm running rake db:setup
Here's the output:
[1] $ rake db:setup --trace ✘
** Invoke db:setup (first_time)
** Invoke db:create (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.+
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/bundler/gems/cantango-36e3ce152717/lib/cantango/configuration/registry.rb:31:in `register'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/bundler/gems/cantango-36e3ce152717/lib/cantango/configuration/candidate_registry.rb:10:in `register'
/home/chintanparikh/Documents/Work/project_name/config/initializers/cantango.rb:8:in `block in <top (required)>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/bundler/gems/cantango-36e3ce152717/lib/cantango.rb:23:in `configure'
/home/chintanparikh/Documents/Work/project_name/config/initializers/cantango.rb:2:in `<top (required)>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `block in load'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/engine.rb:556:in `block (2 levels) in <class:Engine>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/engine.rb:555:in `each'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/engine.rb:555:in `block in <class:Engine>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `instance_exec'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `run'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `each'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `run_initializers'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/application.rb:96:in `initialize!'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/chintanparikh/Documents/Work/project_name/config/environment.rb:5:in `<top (required)>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/application.rb:83:in `require_environment!'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/application.rb:193:in `block (2 levels) in initialize_tasks'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:227:in `call'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:227:in `block in execute'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:222:in `each'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:222:in `execute'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/home/chintanparikh/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:159:in `invoke_with_call_chain'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:187:in `block in invoke_prerequisites'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:185:in `each'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:185:in `invoke_prerequisites'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:165:in `block in invoke_with_call_chain'
/home/chintanparikh/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:159:in `invoke_with_call_chain'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:187:in `block in invoke_prerequisites'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:185:in `each'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:185:in `invoke_prerequisites'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:165:in `block in invoke_with_call_chain'
/home/chintanparikh/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:159:in `invoke_with_call_chain'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:152:in `invoke'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:141:in `invoke_task'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:99:in `block (2 levels) in top_level'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:99:in `each'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:99:in `block in top_level'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:108:in `run_with_threads'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:93:in `top_level'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:71:in `block in run'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:158:in `standard_exception_handling'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:68:in `run'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/bin/rake:37:in `<top (required)>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/bin/rake:19:in `load'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/bin/rake:19:in `<main>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/bin/ruby_noexec_wrapper:14:in `eval'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => db:setup => db:create => environment
Does anyone know how to fix this? It looks like it's failing on the create step.
Cheers.

MongoDB is a schema-less database. You don't need to use any of the rake db:{} functions with it. The only thing you need to do to have mongodb up and running is to install it and then to start the server. You can find more information on installing MongoDB here

Related

NoMethodError with Rails app deployed to Heroku (When calling .create on model)

I am writing a Ruby on Rails web application to be deployed on Heroku.
The development database is SQLite and the production database is PostgreSQL.
Everything works locally in the development and test environments, and worked on Heroku up until the last batch of revisions. Suddenly, attempting to create an instance of the Customer model is throwing
'NoMethodError undefined method `each' for nil:nilclass'.
The migrations have definitely been run, I have tried pg:reset and re-running migrations, and I have also tried restarting heroku.
If I open the rails console on heroku and try to call any of the following methods I get the same error
Customer.count
Customer.create(...)
Customer.new
Can anyone help resolve this issue?
EDIT:
Stacktrace when running rails db:migrate with Postgres DB ( no errors with SQLite )
** Invoke db:_dump (first_time)
** Execute db:_dump
** Invoke db:schema:dump (first_time)
** Invoke db:load_config
** Execute db:schema:dump
rails aborted!
NoMethodError: undefined method `each' for nil:NilClass
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/descriptive_statistics-2.5.1/lib/descriptive_statistics/support/convert.rb:37:in `to_array'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/descriptive_statistics-2.5.1/lib/descriptive_statistics/support/convert.rb:8:in `convert'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/descriptive_statistics-2.5.1/lib/descriptive_statistics/sum.rb:3:in `sum'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/enumerable.rb:185:in `sum'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/schema_statements.rb:659:in `sequence_name_from_parts'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/postgresql/schema_statements.rb:631:in `new_column_from_field'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:115:in `block in columns'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:114:in `map'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:114:in `columns'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/schema_dumper.rb:112:in `table'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/schema_dumper.rb:100:in `block in tables'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/schema_dumper.rb:99:in `each'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/schema_dumper.rb:99:in `tables'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/schema_dumper.rb:44:in `dump'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/schema_dumper.rb:28:in `dump'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:377:in `block in dump_schema'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:376:in `open'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:376:in `dump_schema'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/railties/databases.rake:392:in `block (4 levels) in <main>'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/railties/databases.rake:390:in `each'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/railties/databases.rake:390:in `block (3 levels) in <main>'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `block in execute'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `each'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `execute'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `synchronize'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:188:in `invoke'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/railties/databases.rake:97:in `block (2 levels) in <main>'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `block in execute'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `each'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `execute'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `synchronize'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:188:in `invoke'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activerecord-6.0.3.4/lib/active_record/railties/databases.rake:88:in `block (2 levels) in <main>'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `block in execute'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `each'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:281:in `execute'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `synchronize'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/task.rb:188:in `invoke'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:160:in `invoke_task'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:116:in `each'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:116:in `block in top_level'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:125:in `run_with_threads'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:110:in `top_level'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/rake-13.0.1/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/command.rb:48:in `invoke'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/commands.rb:18:in `<main>'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `block in require'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:291:in `load_dependency'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `require'
/Users/harilimaye/Documents/CompSci/Year 2/SEG/smg/alpaca_online_banking/bin/rails:9:in `<top (required)>'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
/Users/harilimaye/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:72:in `require'
/Users/harilimaye/Documents/CompSci/Year 2/SEG/smg/alpaca_online_banking/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
So it turned out the problem was due to the inclusion of gem 'transaction_faker' in my gem-file, which added the module descriptive_statistics (the source of the problem). My GUESS is that it must override the sum method of the Enumerable module used in the conversion from migration to Postgres, or something along those lines.

Ruby On Rails - NoMethodError: undefined method `[]' for nil:NilClass

I'm trying to run on a new computer some ruby code and I receive the following error (rails db:migrate --trace)
** Invoke db:migrate (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
rails aborted!
NoMethodError: undefined method `[]' for nil:NilClass
/Users/jairochavez/Documents/Rails/rfdf_bolivia/config/initializers/stripe.rb:2:in `<main>'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `block in load'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:657:in `block in load_config_initializer'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/notifications.rb:170:in `instrument'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:656:in `load_config_initializer'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:614:in `block (2 levels) in <class:Engine>'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:613:in `each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:613:in `block in <class:Engine>'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `instance_exec'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `run'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:61:in `block in run_initializers'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:50:in `each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:50:in `tsort_each_child'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:415:in `call'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:415:in `each_strongly_connected_component_from'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:347:in `each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:347:in `call'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:60:in `run_initializers'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/application.rb:361:in `initialize!'
/Users/jairochavez/Documents/Rails/rfdf_bolivia/config/environment.rb:5:in `<main>'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/application.rb:337:in `require_environment!'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/application.rb:520:in `block in run_tasks_blocks'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `block in execute'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `execute'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:238:in `block in invoke_prerequisites'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `invoke_prerequisites'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:213:in `block in invoke_with_call_chain'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:238:in `block in invoke_prerequisites'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `invoke_prerequisites'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:213:in `block in invoke_with_call_chain'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:183:in `invoke'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:160:in `invoke_task'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `block in top_level'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:125:in `run_with_threads'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:110:in `top_level'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/command.rb:48:in `invoke'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<main>'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
/Users/jairochavez/Documents/Rails/rfdf_bolivia/bin/rails:9:in `<top (required)>'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Users/jairochavez/Documents/Rails/rfdf_bolivia/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => db:migrate => db:load_config => environment
config/initializers/stripe.rb
Rails.configuration.stripe = {
publishable_key: Rails.application.credentials[Rails.env.to_sym][:stripe][:public_key],
secret_key: Rails.application.credentials[Rails.env.to_sym][:stripe][:secret_key]
}
Stripe.api_key = Rails.configuration.stripe[:secret_key]
From the stacktrace you posted, this line in particular appears to be the issue:
Rails.application.credentials[Rails.env.to_sym][:stripe][:public_key]
Since you're chaining multiple hash accesses, one of those objects is nil. You could try inspecting each of them by adding something like this to the top of the initializer:
puts Rails.application.credentials.inspect
puts Rails.application.credentials[Rails.env.to_sym].inspect
puts Rails.application.credentials[Rails.env.to_sym][:stripe].inspect
That will tell you which part is nil that shouldn't be, and you can update your credentials file accordingly.
Based on your configuration you should have your credentials.yml looking something like this:
stripe:
secret_key: pk_123456789012345
public_key: sk_abcdefghijklnmk
In your stripe.rb you missed [:secret_key]. It should look like this. But this won't work either when you are precompiling in production.
Stripe.api_key = Rails.application.credentials[Rails.env.to_sym][:stripe][:secret_key]
Use dig method instead.
So for your stripe.rb
Stripe.api_key = Rails.application.credentials.dig(:stripe, :secret_key)
In your terminal run
RAILS_ENV=production rails c
In the console run
Rails.application.credentials.dig(:stripe, :secret_key)
Now you should get a value.
This was an issue I ran into and suffered until I figure it out. It seems to be an issue with rails code base. Not sure we need to load credentials to compile assets. Anyways, they close this issue but I am not sure why they closed it. Here is the link to the issue. https://github.com/rails/rails/issues/32947
When cloning an existing repo, you might run into this error if you do not have a config/master.key file, (which is not checked in to source control, e.g. GitHub). This is because, as #Elias Glyptis pointed out, credentials are needed to compile assets, (as documented in Rails #32947).
config/initializer/stripe.rb
Stripe.api_key = Rails.application.credentials.dig(Rails.env.to_sym, :stripe, :secret)

Rails-ERD, Graphviz error. Other answers not working. "Saving diagram failed! Verify that Graphviz is installed and in your path, or use filetype=dot"

I am on Rails 5.1, and on a Mac running Sierra. I've already read and tried the solutions listed on other similar questions (1, 2). I have 3 different Rails projects that I'm working on and have rails-erd installed on all of them, but it is not working on one of them.
When I run rails ert --trace:
>rails erd --trace
** Invoke erd (first_time)
** Invoke erd:generate (first_time)
** Invoke erd:check_dependencies (first_time)
** Execute erd:check_dependencies
** Invoke erd:options (first_time)
** Execute erd:options
** Invoke erd:load_models (first_time)
** Execute erd:load_models
Loading application environment...
** Invoke environment (first_time)
** Execute environment
Loading code in search of Active Record models...
** Execute erd:generate
Generating Entity-Relationship Diagram for 13 models...
rails aborted!
Saving diagram failed!
Verify that Graphviz is installed and in your path, or use filetype=dot.
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram/graphviz.rb:211:in `rescue in block in <class:Graphviz>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram/graphviz.rb:202:in `block in <class:Graphviz>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:169:in `instance_eval'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:169:in `save'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:120:in `create'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:74:in `create'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/tasks.rake:55:in `block (2 levels) in <top (required)>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:216:in `block in invoke_prerequisites'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:214:in `each'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:214:in `invoke_prerequisites'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:193:in `block in invoke_with_call_chain'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/commands/rake/rake_command.rb:21:in `block in perform'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/command.rb:46:in `invoke'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/commands.rb:16:in `<top (required)>'
/Users/jaysonwhelpley/Sites/biq/bin/rails:9:in `require'
/Users/jaysonwhelpley/Sites/biq/bin/rails:9:in `<top (required)>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
/Users/jaysonwhelpley/Sites/biq/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
NoMethodError: undefined method `zero?' for nil:NilClass
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/ruby-graphviz-1.2.3/lib/graphviz/utils.rb:58:in `output_from_command'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/ruby-graphviz-1.2.3/lib/graphviz.rb:600:in `output'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram/graphviz.rb:204:in `block in <class:Graphviz>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:169:in `instance_eval'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:169:in `save'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:120:in `create'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:74:in `create'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/tasks.rake:55:in `block (2 levels) in <top (required)>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:216:in `block in invoke_prerequisites'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:214:in `each'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:214:in `invoke_prerequisites'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:193:in `block in invoke_with_call_chain'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/commands/rake/rake_command.rb:21:in `block in perform'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/command.rb:46:in `invoke'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-5.1.2/lib/rails/commands.rb:16:in `<top (required)>'
/Users/jaysonwhelpley/Sites/biq/bin/rails:9:in `require'
/Users/jaysonwhelpley/Sites/biq/bin/rails:9:in `<top (required)>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
/Users/jaysonwhelpley/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
/Users/jaysonwhelpley/Sites/biq/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => erd => erd:generate
I have already installed graphviz.
The rake erd filetype=dot command works just fine, but trying the option of using:
erd --inheritance --direct --attributes=foreign_keys,content --filetype=dot
dot -Tjpg erd.dot > erd.jpg
It just creates an empty erd.jpg.
Any help?
I was having a similar problem, what I did was the following:
Put the following patch on initializers, you can find the explanation here ERD issue:
require 'rails_erd/domain/relationship'
module RailsERD
class Domain
class Relationship
class << self
private
def association_identity(association)
Set[association_owner(association), association_target(association)]
end
end
end
end
end
Generate the dot file
rake erd filetype=dot --trace
Generate the pdf file
dot -Tpdf -oERD.pdf -v erd.dot

rake db:schema:load works in development but not production

I have searched this site and Google for hours. When I run rake db:schema:load everything works fine (development), but running rake db:schema:load RAILS_ENV=production --trace I get the following:
C:\Sites\14-Meerkat>rake db:schema:load RAILS_ENV=production --trace
** Invoke db:schema:load (first_time)
** Invoke environment (first_time)
** Execute environment
Mysql2::Error: Table 'sei_mk_prod.charities' doesn't exist: SHOW FULL FIELDS FROM `charities`
rake aborted!
Mysql2::Error: Table 'sei_mk_prod.charities' doesn't exist: SHOW FULL FIELDS FROM `charities`
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:286:in `query'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:286:in `block in execute'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:425:in `block in log'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:420:in `log'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:286:in `execute'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/connection_adapters/mysql2_adapter.rb:220:in `execute'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:300:in `execute_and_free'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:461:in `columns'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/connection_adapters/schema_cache.rb:114:in `block in prepare_default_proc'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/connection_adapters/schema_cache.rb:56:in `yield'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/connection_adapters/schema_cache.rb:56:in `columns'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/model_schema.rb:208:in `columns'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activerecord-4.0.0/lib/active_record/model_schema.rb:247:in `column_names'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/auto_html-1.6.0/lib/auto_html/auto_html_for.rb:21:in `auto_html_for'
C:/Sites/14-Meerkat/app/models/charity.rb:9:in `<class:Charity>'
C:/Sites/14-Meerkat/app/models/charity.rb:1:in `<top (required)>'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:329:in `require_or_load'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:288:in `depend_on'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:206:in `require_dependency'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/engine.rb:465:in `block (2 levels) in eager_load!'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/engine.rb:464:in `each'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/engine.rb:464:in `block in eager_load!'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/engine.rb:462:in `each'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/engine.rb:462:in `eager_load!'
C:in `eager_load!'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `each'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/1.9.1/tsort.rb:150:in `block in tsort_each'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/1.9.1/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/1.9.1/tsort.rb:219:in `each_strongly_connected_component_from'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/1.9.1/tsort.rb:182:in `block in each_strongly_connected_component'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/1.9.1/tsort.rb:180:in `each'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/1.9.1/tsort.rb:180:in `each_strongly_connected_component'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/1.9.1/tsort.rb:148:in `tsort_each'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
C:/Sites/14-Meerkat/config/environment.rb:5:in `<top (required)>'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/application.rb:249:in `block in run_tasks_blocks'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:197:in `block in invoke_prerequisites'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:195:in `each'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:195:in `invoke_prerequisites'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:174:in `block in invoke_with_call_chain'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
C:/BitNami/rubystack-1.9.3-16-2/ruby/lib/ruby/gems/1.9.1/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
C:/BitNami/rubystack-1.9.3-16-2/ruby/bin/rake:23:in `load'
C:/BitNami/rubystack-1.9.3-16-2/ruby/bin/rake:23:in `<main>'
Tasks: TOP => db:schema:load => environment
Any thoughts?
The problem was in the charity.rb file of course. I haven't figured out the exact problem yet, but commenting out the code block starting at line 9 and a similar one in another model resolved the problem. Hope this helps some other frustrated programmer somewhere. :-)
Update:
One of my colleagues discovered he had initialized something in development.rb but not in production.rb. That initialization was for the code in charity.rb that was causing the problem.
See this question.
Which states
If you run rake db:schema:load on a production server, you'll end up deleting all your production data. This is a dangerous habit to get into.
Try running rake db:migrate. Keep running rake db:migrate. If you really need a fresh setup, did you try rake db:reset or rake db:setup?

Could not find table by rake routes on production server

When checking routes on production server with rake routes, there is an error of Could not find table 'authentify_engine_configs' which is a table in the database. What could cause this error? The following is full trace:
cjadmin#ubuntu-ibm:/var/www/nbhyop/current$ bundle exec rake routes --trace
** Invoke routes (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
Could not find table 'authentify_engine_configs'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/connection_adapters/sqlite_adapter.rb:472:in `table_structure'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/connection_adapters/sqlite_adapter.rb:346:in `columns'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/connection_adapters/schema_cache.rb:12:in `block in initialize'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/model_schema.rb:228:in `yield'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/model_schema.rb:228:in `default'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/model_schema.rb:228:in `columns'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/model_schema.rb:237:in `columns_hash'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/locking/optimistic.rb:129:in `locking_enabled?'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/relation.rb:170:in `exec_queries'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/relation.rb:160:in `block in to_a'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/explain.rb:33:in `logging_query_plan'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/relation.rb:159:in `to_a'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/relation/finder_methods.rb:378:in `find_first'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activerecord-3.2.12/lib/active_record/relation/finder_methods.rb:122:in `first'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/bundler/gems/authentify-6d86f5486c71/app/custom/authentify/authentify_utility.rb:85:in `find_config_const'
/var/www/nbhyop/releases/20130514202149/config/initializers/my_constants.rb:7:in `<top (required)>'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:245:in `load'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:245:in `block in load'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.12/lib/active_support/dependencies.rb:245:in `load'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/engine.rb:587:in `each'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/engine.rb:587:in `block in <class:Engine>'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `instance_exec'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `run'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `each'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `run_initializers'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/application.rb:136:in `initialize!'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `method_missing'
/var/www/nbhyop/releases/20130514202149/config/environment.rb:6:in `<top (required)>'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/application.rb:103:in `require'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/application.rb:103:in `require_environment!'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.12/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:246:in `call'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:241:in `each'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain'
/home/cjadmin/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:205:in `block in invoke_prerequisites'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:203:in `each'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:203:in `invoke_prerequisites'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:183:in `block in invoke_with_call_chain'
/home/cjadmin/.rvm/rubies/ruby-1.9.3-p286/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/application.rb:101:in `each'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/gems/rake-10.0.4/bin/rake:33:in `<top (required)>'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/bin/rake:23:in `load'
/home/cjadmin/.rvm/gems/ruby-1.9.3-p286/bin/rake:23:in `<main>'
Tasks: TOP => routes => environment
cjadmin#ubuntu-ibm:/var/www/nbhyop/current$
It is rails 3.2.12 app running on ubuntu with nginx and passenger. rake db:migrate has the same error.
Thanks for help.
If it really is production then you need to tell rails, otherwise it will use development by default
RAILS_ENV=production bundle exec rake routes

Resources