错误消息:#Error中的NameError / users / sign

编程入门 行业动态 更新时间:2024-10-11 01:09:59
本文介绍了错误消息:#Error中的NameError / users / sign_in未定义的局部变量或方法`require_no_authentication'for#< SessionsController:0x ########>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在使用Devise的RoR应用程序。当我今天上班的时候,试图启动我的本地开发环境时,当我尝试登录页面时,RoR失败:

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的存储库: github/ 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 and rake db:terraform.
  • I ran bundle install.
  • I ran rvm gemset empty and bundle 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: github/plataformatec/devise/issues/2520

更多推荐

错误消息:#Error中的NameError / users / sign

本文发布于:2023-10-27 23:47:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1534881.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   消息   Error   sign   users

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!