【问题标题】:The method 'clear_helpers' in ApplicationController - not found - method undefined for undefined method `user_signed_in?'ApplicationController 中的方法“clear_helpers” - 未找到 - 未定义方法“user_signed_in?”的方法未定义?
【发布时间】:2017-02-01 00:46:25
【问题描述】:

我一直看到这个答案: “尝试删除 ApplicationController 中的 'clear_helpers' 方法,因为它有时可能会阻止设计加载他的助手。”

如果它真的可以移除,那就太好了。

关键是在您登录并同时显示其他内容之前,不要查看博客页面。 (设计)

我的页面出现错误:http://pastebin.com/rFx17ecG 我的应用程序.rb:http://pastebin.com/MRCLVh0M

我完全看不出与“clear_helpers”有关。我需要帮助和澄清,因为它似乎不存在..

【问题讨论】:

    标签: ruby-on-rails ruby devise ruby-on-rails-5


    【解决方案1】:

    为了能够使用user_signed_in?,您需要在控制器中使用before_filter :authenticate_user!。查看documentation

    【讨论】:

    • 好吧,问题是我从未运行过 rails g devise user (smh)。但即使在那之后,我也不必使用'before_filter :authenticate_user!'(仔细检查它不是自动创建的或奇怪的东西。)谢谢你的帮助。
    猜你喜欢
    • 2013-08-30
    • 1970-01-01
    • 2017-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-06
    • 2012-09-17
    • 1970-01-01
    相关资源
    最近更新 更多