Skip to content

Instantly share code, notes, and snippets.

@sam452
Created May 19, 2014 15:21
Show Gist options
  • Save sam452/604f57c0525cf3416129 to your computer and use it in GitHub Desktop.
Save sam452/604f57c0525cf3416129 to your computer and use it in GitHub Desktop.
Why am I getting rails 4 migrate super: no superclass method `version' activerecord errors when I rake db:migrate?
Migration successful on Windows. Commit and pushed to github. Pulled on Mac which has successfully run this app before. But migration fails on the Mac.
All other migrations on other Rails apps on the Mac fail with the same error.
Stepped down to Ruby 1.9.3 but failure repeats.
The only instance of 'version' that shows up in Sublime text of the app that is not commented out is in Schema.rb. The usage matches previous successful commits.
rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
rake aborted!
super: no superclass method `version' for #<ActiveRecord::SchemaMigration:0x00000101971a88>
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/activemodel-4.0.2/lib/active_model/attribute_methods.rb:436:in `method_missing'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.2/lib/active_record/attribute_methods.rb:155:in `method_missing'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.2/lib/active_record/schema_migration.rb:36:in `version'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.2/lib/active_record/migration.rb:787:in `block in get_all_versions'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.2/lib/active_record/relation/delegation.rb:13:in `map'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.2/lib/active_record/relation/delegation.rb:13:in `map'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.2/lib/active_record/migration.rb:787:in `get_all_versions'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.2/lib/active_record/migration.rb:949:in `migrated'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.2/lib/active_record/migration.rb:954:in `ran?'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.2/lib/active_record/migration.rb:931:in `block in runnable'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.2/lib/active_record/migration.rb:931:in `reject'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.2/lib/active_record/migration.rb:931:in `runnable'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.2/lib/active_record/migration.rb:908:in `migrate'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.2/lib/active_record/migration.rb:764:in `up'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.2/lib/active_record/migration.rb:742:in `migrate'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/activerecord-4.0.2/lib/active_record/railties/databases.rake:42:in `block (2 levels) in <top (required)>'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/task.rb:236:in `call'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/task.rb:236:in `block in execute'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/task.rb:231:in `each'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/task.rb:231:in `execute'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
/Users/sam/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/task.rb:168:in `invoke_with_call_chain'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/task.rb:161:in `invoke'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/application.rb:149:in `invoke_task'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/application.rb:106:in `each'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/application.rb:106:in `block in top_level'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/application.rb:115:in `run_with_threads'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/application.rb:100:in `top_level'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/application.rb:78:in `block in run'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/lib/rake/application.rb:75:in `run'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/gems/rake-10.1.1/bin/rake:33:in `<top (required)>'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/bin/rake:23:in `load'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/bin/rake:23:in `<main>'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `eval'
/Users/sam/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:migrate
@gabrieljoelc
Copy link

Did you ever resolve this? I am able to run migrations with no error but I get this same error when I run the app.

@tak1n
Copy link

tak1n commented Nov 19, 2014

@gabrieljoelc check if your schema_migrations table has the column version.
Also try to execute rake db:migrate:status then you should see the pg gem throwing an error because the version column in the schema_migrations table is not found.

At least this was the case for me.

@klebershimabuku
Copy link

klebershimabuku commented Dec 25, 2016

I don't know if there are any other easy way of doing this, but I had to add this column manually to the schema_migrations table to get it work again.

@ainar-g
Copy link

ainar-g commented Aug 23, 2018

Some explanation can be found in my answer here: https://stackoverflow.com/a/51989696/1892060.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment