我在application_helper.rb中定义了一个帮助器,我想在我的邮件程序视图中使用,但只是在做
<%= helper_method(param) %>
mailer_view.html.erb文件中的给我一个'未定义的方法'错误。
还有其他办法吗?我不想在其他地方放置同一个助手。
感谢。
答案 0 :(得分:5)
显然以前曾经问过这个问题(谁知道!):)。 answer包括
helper ApplicationHelper
在example_mailer.rb文件中:
class ExampleMailer < ApplicationMailer
helper ApplicationHelper
...
end