我正在使用Devise开发RoR应用程序。当我今天上班并试图启动我的本地开发环境时,当我尝试进入登录页面时,RoR失败了:
NameError at /users/sign_in
undefined local variable or method `require_no_authentication' for #<SessionsController:0x########>
看起来错误不是在我们编写的代码中引发的,而是来自Devise gem中的深层。我猜不知道,我的开发机器没有正确配置。
以下是我尝试修复错误的一些事项:
rake db:migrate
和rake db:terraform
。bundle install
。rvm gemset empty
和bundle install
重新安装了我的所有宝石。这些都不起作用。
此外,关于此错误还有一些更奇怪的事情:
有人知道我可以做些什么来尝试修复此错误吗?听起来我的本地配置的某些部分设置不正确吗?
答案 0 :(得分:0)
在我的项目中,我在app/controllers
中添加了一个名为devise_controller.rb
的文件。它看起来像这样:
class DeviseController < ApplicationController
# Asks Devise how much time is left until the current user is
# automatically logged out, without resetting the logout timer.
def time_until_logout
raise "let's inspect here"
end
end
当我删除此文件时,错误就消失了。
我提交了一份错误报告,说明如何添加DeviseController
导致RoR / Devise炸毁Devise的存储库:https://github.com/plataformatec/devise/issues/2520