gpt4 book ai didi

ruby-on-rails - Rails Controller 错误 : syntax error, 意外的 keyword_end,期望输入结束

转载 作者:太空宇宙 更新时间:2023-11-03 16:51:01 25 4
gpt4 key购买 nike

我正在使用 Rails 4 构建应用程序并尝试运行服务器。我在第 1 行收到一个涉及应用程序 Controller 的错误。由于此错误,本地主机将不会运行服务器:语法错误,意外的 keyword_end,期望输入结束。机架 session 状态:ActionDispatch::Request::Session:0x1072f1ef0 尚未加载。这是我的应用程序 Controller :

class ApplicationController < ActionController::Base
protect_from_forgery
include SessionsHelper
end

另一个 Controller 有一个相同的应用程序帧错误。就像应用程序 Controller 一样,它里面的代码很少,并且有正确数量的“结束”。在我的“所有帧”选项卡中,有大量错误涉及 ActiveSupport、ActionController 和许多其他错误。太多了,无法一一列举。

有没有人知道是什么导致了这些错误?提前致谢!

最佳答案

如果您将 ApplicationController 中的这些行翻转为如下所示:

class ApplicationController < ActionController::Base
include SessionsHelper

protect_from_forgery
end

protect_from_forgery 之前我从未见过任何东西 - 只是一种预感。

关于ruby-on-rails - Rails Controller 错误 : syntax error, 意外的 keyword_end,期望输入结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21894777/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com