Reputation: 83
I'm getting the below error message, not sure how to resolve it. Can anyone help please?
NoMethodError: undefined method `needs_migration?' for ActiveRecord::Migrator:Class
Here is the config.ru code:
require './config/environment'
if ActiveRecord::Migrator.needs_migration?
raise 'Migrations are pending. Run `rake db:migrate` to resolve the issue.'
end
use Rack::MethodOverride
use UsersController
use ArtworkController
run ApplicationController
Upvotes: 6
Views: 3075
Reputation: 1230
change your code to
if ActiveRecord::Base.connection.migration_context.needs_migration?
raise 'Migrations are pending. Run `rake db:migrate` to resolve the issue.'
end
Upvotes: 15