ActiveRecord::PendingMigrationError (DEVISE ERROR) - Rails



我试着运行http://localhost:3000/users/sign_up但它给了我一个错误:

ActiveRecord::PendingMigrationError
Migrations are pending. To resolve this issue, run: bin/rake db:migrate RAILS_ENV=development
Rails.root: c:/xampp/htdocs/pinteresting
Application Trace | Framework Trace | Full Trace
activerecord (4.2.5) lib/active_record/migration.rb:392:in `check_pending!'
activerecord (4.2.5) lib/active_record/migration.rb:373:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.5) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
activesupport (4.2.5) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
activesupport (4.2.5) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.5) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
web-console (2.2.1) lib/web_console/middleware.rb:39:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.5) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.5) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.5) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.5) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/request_id.rb:21:in `call'

这让我头疼。我是rails的新手,我确保我通过设计gem正确设置了一切。现在我该怎么办?请帮忙吗?

我运行bin/rake db:migrate RAILS_ENV=development

但它表示,"bin"并不是一个公认的内部或外部命令。在我问之前试过了。

调用同一命令的两种方式略有不同:rake db:migrate RAILS_ENV=development,它删除了"bin"元素并且无论如何都应该工作。

或者bundle exec rake db:migrate RAILS_ENV=development,它使用bundle exec在项目中运行命令。

确保您在正确的目录中运行任何类似的命令,即在项目根目录中运行rails server等的命令。

您可以尝试:

    ActiveRecord::Migrator.migrate("db/migrate/", nil)

最新更新