Devise在heroku上崩溃我的rails应用程序,“未定义的局部变量或方法`mimes_for_respond_to'”

时间:2015-02-09 15:38:17

标签: ruby-on-rails heroku devise

由于添加了devise gem,heroku无法在生产中加载我的应用程序,因此给出了应用程序错误:

An error occurred in the application and your page could not be served. Please try again in a few moments.

If you are the application owner, check your logs for details.

来自控制台的特定错误日志是

/app/vendor/bundle/ruby/2.1.0/gems/devise-3.3.0/app/controllers/devise_controller.rb:13:in `<class:DeviseController>': undefined local variable or method `mimes_for_respond_to' for DeviseController:Class (NameError)
from /app/vendor/bundle/ruby/2.1.0/gems/devise-3.3.0/app/controllers/devise_controller.rb:2:in `<top (required)>'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:274:in `require'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:274:in `block in require'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:240:in `load_dependency'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:274:in `require'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:360:in `require_or_load'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:494:in `load_missing_constant'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:184:in `const_missing'
from /app/vendor/bundle/ruby/2.1.0/gems/devise-3.3.0/app/controllers/devise/confirmations_controller.rb:1:in `<top (required)>'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:274:in `require'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:274:in `block in require'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:240:in `load_dependency'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:274:in `require'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:360:in `require_or_load'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:317:in `depend_on'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:233:in `require_dependency'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/engine.rb:472:in `block (2 levels) in eager_load!'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/engine.rb:471:in `each'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/engine.rb:471:in `block in eager_load!'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/engine.rb:469:in `each'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/engine.rb:469:in `eager_load!'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/engine.rb:346:in `eager_load!'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/application/finisher.rb:56:in `each'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/initializable.rb:30:in `instance_exec'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/initializable.rb:30:in `run'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each'
from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `call'
from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
from /app/vendor/ruby-2.1.5/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/initializable.rb:54:in `run_initializers'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/application.rb:352:in `initialize!'
from /app/config/environment.rb:5:in `<top (required)>'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:274:in `require'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:274:in `block in require'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:240:in `load_dependency'
from /app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.2.0.rc3/lib/active_support/dependencies.rb:274:in `require'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/application.rb:328:in `require_environment!'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/commands/commands_tasks.rb:142:in `require_application_and_environment!'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/commands/commands_tasks.rb:67:in `console'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /app/vendor/bundle/ruby/2.1.0/gems/railties-4.2.0.rc3/lib/rails/commands.rb:17:in `<top (required)>'
from /app/bin/rails:8:in `require'
from /app/bin/rails:8:in `<main>'

我已尝试在互联网上浮动多个建议,但到目前为止还没有任何建议。提前谢谢!

1 个答案:

答案 0 :(得分:5)

快速谷歌搜索将您的问题与需要更新的responders gem相关联。请查看this issue in Devise gem。只要respondersDevise依赖关系,您就不需要将其包含在Gemfile中(仔细检查Gemfile.lock中),您只需要使用以下命令更新到上一个版本:

bundle update responders

如果responders gem不可用,请在运行上一个命令之前将gem 'responders'添加到Gemfile

希望它有所帮助。