Cannot run any commands on my heroku app (migrate, console, etc)
heroku, ruby, ruby-on-rails
Solution
The config `dump_schema_after_migration` didn't exist in Rails 4.0.4 .
You got the error because you deployed initially with Rails v4.1.0rc1 and switched over to v4.0.4 later. What really happened is that when you generated your app with rails 4.1.0rc, the generator put the config `dump_schema_after_migration` into your `config/environments/production.rb` and Rails 4.1.0rc1's code has this to support this config :
mattr_accessor :dump_schema_after_migration
Hence everything works fine in v4.1.0rc1. But when you moved back to v4.0.4, the config is still there in `config/environments/production.rb` , but the Rails code no longer knows how to read this config. To solve this, either stick with Rails 4.1.0rc1 code, or remove the config from `config/environments/production.rb` when running on Rails 4.0.4.
Btw, I added `dump_schema_after_migration` config to Rails code.
Problem
I am running rails 4.0.4 with ruby 2.1.1. app location: https://github.com/ravjohal/dozmia When I try to run commands on heroku, for instance: ``` ravjohal$ heroku run rake db:migrate ``` I get the following error: ``` Running `rake db:migrate` attached to terminal... up, run.2545 rake aborted! NoMethodError: undefined method `dump_schema_after_migration=' for ActiveRecord::Base:Class /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/dynamic_matchers.rb:22:in `method_missing' /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/railtie.rb:166:in `block (3 levels) in <class:Railtie>'...../app/config/environment.rb:5:in `<top (required)>'.... ``` here is part of the heroku logs: ``` /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/dynamic_matchers.rb:22:in `method_missing': undefined method `dump_schema_after_migration=' for #<Class:0x007fa6e13d76d0> (NoMethodError) 2014-03-27T18:30:55.729964+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.4/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks' 2014-03-27T18:30:55.729964+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.4/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks' 2014-03-27T18:30:55.729964+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.4/lib/active_support/lazy_load_hooks.rb:44:in `each' 2014-03-27T18:30:55.730401+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.0.4/lib/rails/engine.rb:464:in `each' 2014-03-27T18:30:55.730191+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.0.4/lib/rails/engine.rb:465:in `block (2 levels) in eager_load!' 2014-03-27T18:30:55.730191+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `require' 2014-03-27T18:30:55.729964+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.4/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval' 2014-03-27T18:30:55.729964+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/railtie.rb:165:in `block (2 levels) in <class:Railtie>' 2014-03-27T18:30:55.729964+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.4/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook' 2014-03-27T18:30:55.729964+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/railtie.rb:165:in `each' 2014-03-27T18:30:55.730191+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.4/lib/active_support/dependencies.rb:229:in `b lock in require' 2014-03-27T18:30:55.730191+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.0.4/lib/active_record/base.rb:22:in `<top (required)>' 2014-03-27T18:30:55.730191+00:00 app[web.1]: from /app/app/models/playlist.rb:1:in `<top (required)>' ``` I had deployed my app using 4.1.0rc1 Rails (worked fine) and then changed the Gemfile to use 4.0.4 instead. I also changed my local development database to pg instead of sqllite3. Those are the only two changes I have made and only after those changes did the issue appear on heroku. App works great on localhost. EDIT: I also want to add that I changed the app name locally (not sure if that would matter though).