错误消息:#Error中的NameError / users / sign_in未定义的局部变量或方法`require_no_authentication'for#< SessionsController:0x ########> [英] Error message: NameError at /users/sign_in undefined local variable or method `require_no_authentication' for #<SessionsController:0x########>
问题描述
Name / at / users / sign_in
未定义局部变量或方法`require_no_authentication'for#< SessionsController:0x ########>
看起来我们写的代码中没有提出错误,而是从设计宝石。我猜,我的开发机器配置不正确。
以下是我尝试修复错误的一些事情:
- 我运行
rake db:migrate
和rake db:terraform
。 - 我运行
bundle install
。 - 我跑了$ c> rvm gemset empty 和
bundle install
重新安装我所有的宝石。
这些都没有起作用。
此外,这是一个更奇怪的事情关于这个错误:
- 我的工作场所的其他开发人员都不会有相同的错误,即使他们在同一个代码库。
- 之后试图弄清楚一段时间的错误,我转到一个分支,我没有更新,因为我开始得到这个错误。即使在周末之前工作,该分支现在也失败了同样的错误。
有人知道我可以做什么修复这个错误?这听起来像我的本地配置的一部分设置不正确吗?
在我的项目中,我添加了一个文件 app / controllers
调用 devise_controller.rb
。它看起来像这样:
class DeviseController< ApplicationController
#要求Devise剩余多少时间,直到当前用户
#自动注销,而不需要重置注销计时器。
def time_until_logout
raise让我们在这里检查
end
end
当我删除此文件时,错误消失了。
我提交了关于如何添加 DeviseController
导致RoR / Devise炸毁Devise的存储库: https://github.com/ plataformatec / devise / issues / 2520
I'm working on a RoR app with Devise. When I came in to work today and tried to start up my local dev environment, RoR failed when I tried to go to the sign in page:
NameError at /users/sign_in
undefined local variable or method `require_no_authentication' for #<SessionsController:0x########>
It looks like the error is not being raised within the code we wrote, but instead from deep within the Devise gem. I'm guessing that somehow, my dev machine isn't configured right.
Here are some things I've tried to fix the bug:
- I ran
rake db:migrate
andrake db:terraform
. - I ran
bundle install
. - I ran
rvm gemset empty
andbundle install
to reinstall all of my gems.
None of these worked.
In addition, here are a couple more strange things about this error:
- None of the other devs at my workplace are having the same error, even though they're on the same codebase.
- After trying to figure out the error for a while, I switched to a branch that I haven't updated since before I started getting this bug. Even though it was working before the weekend, that branch now fails with the same error.
Does anybody know anything I could do to try to fix this error? Does it sound like some part of my local configuration is incorrectly set up?
In my project, I had added a file in app/controllers
called devise_controller.rb
. It looked like this:
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
When I deleted this file, the bug went away.
I filed a bug report about how adding a DeviseController
caused RoR/Devise to blow up on Devise's repository: https://github.com/plataformatec/devise/issues/2520
这篇关于错误消息:#Error中的NameError / users / sign_in未定义的局部变量或方法`require_no_authentication'for#< SessionsController:0x ########>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!