ruby-on-rails - rails : Expected helper to define

在本地访问我的 Rails 应用程序时,加载任何页面时出现以下错误:

/!\ FAILSAFE /!\  Tue Jul 06 15:08:17 -0500 2010
Status: 500 Internal Server Error
Expected /my_rails_app/app/helpers/admin/article_categories_helper.rb to define Admin::ArticleCategoriesHelper

如果我按照 full trace ,我在我的应用程序 Controller 中被带到了这一行:

helper :all

如果我注释掉该行,一切似乎都能正常加载。

此外,这是我的 /admin/article_categories_helper.rb 文件的内容:

module Admin::ArticleCategoriesHelper
end

那么,有什么想法可能导致这种情况以及如何解决它吗?

最佳答案

如果您尝试 serioken 的回答并得到“xxxx 不是模块”,则将其更改为类。 以下对我有用。

我有:/helpers/member/finance/bank_batches_helper.rb

其中我有:

module Member::Finance::BankBatchesHelper

  def some_method
    # ...
  end
end

简单地添加上面的父类:

class Member
  class Finance
  end
end

module Member::Finance::BankBatchesHelper

  def some_method
    # ...
  end
end

希望这对您有所帮助。

关于ruby-on-rails - rails : Expected helper to define helper error?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3189852/

相关文章:

asp.net-mvc - ASP.Net MVC 2.0 : unescaping URL que

sql - 对于每个唯一的 A 列,什么 SQL 查询返回具有最新日期和时间(B 列和 C 列)的行

orm - Eclipselink - 坚持后的ID仍然为空

git - 如何使用 ssh 将 repo 克隆到远程服务器

file - 如果文件长度相同,哈希冲突的可能性有多大?

open-source - 用于检测运行笔迹的开源

c# - 以特定时间间隔从视频(mpg、wmv 等)中捕获帧

ejabberd - 如何阻止 ejabberd 使用 mnesia

python - python 中的 Rfc 1123

apache - 在 ReverseProxy 上下文中切换 SSLVerifyClient