liq*_*ord 3 activerecord ruby-on-rails nomethoderror
我收到以下错误消息,不知道如何解决它.有人可以帮忙吗?
NoMethodError:未定义的方法`needs_migration?' 对于ActiveRecord :: Migrator:Class
这是config.ru代码:
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
Run Code Online (Sandbox Code Playgroud)
将您的代码更改为
if ActiveRecord::Base.connection.migration_context.needs_migration?
raise 'Migrations are pending. Run `rake db:migrate` to resolve the issue.'
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1300 次 |
| 最近记录: |