了解 Rails 助手
我有两个帮助文件。 events_helper.rb 和 users_helper.rb。
这两个帮助程序文件都有一个名为 foobar
的方法。在事件控制器中,索引视图。如果我调用 foobar
.难道它不应该加载 events_helper.rb 中的帮助器 foobar
吗?
或者这不是助手的工作方式?
I have two helper files. events_helper.rb and users_helper.rb.
Both of these helper files have a method called foobar
. In events controller, index view. If I call foobar
. Shouldn't it load the helper foobar
thats in events_helper.rb?
Or is this not the way helpers work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
似乎所有助手都可用 - 所以不确定在您的情况下会选择哪一个,最好是事件控制器……从您的评论来看,它似乎选择了错误的一个。
你能给他们起不同的名字吗?
为什么所有 Rails 助手始终可供所有视图使用?有办法禁用它吗?
Seems like all helpers are available - so not sure which it would choose in your case, ideally the events controller one... and from your comment, it seems like its chosen the wrong one.
Could you give them distinct names?
Why are all Rails helpers available to all views, all the time? Is there a way to disable this?