Col*_* Wu 3 actionmailer helpers ruby-on-rails-4
我在application_helper.rb中定义了一个助手,希望在邮件视图中使用它,但是只是在做
<%= helper_method(param) %>
Run Code Online (Sandbox Code Playgroud)
在mailer_view.html.erb文件中,显示“未定义方法”错误。
还有另一种方法吗?我讨厌不得不将同一个助手放在其他地方。
谢谢。
显然,这已经被问过了(谁知道!):)。的回答是包括
helper ApplicationHelper
Run Code Online (Sandbox Code Playgroud)
在example_mailer.rb文件中:
class ExampleMailer < ApplicationMailer
helper ApplicationHelper
...
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
893 次 |
| 最近记录: |