我在 application_helper.rb 中定义了一个助手,我想在邮件程序 View 中使用它,但只是在做
<%= helper_method(param) %>
在 mailer_view.html.erb 文件中出现“未定义方法”错误。
有没有另一种方法可以做到这一点?我不想把同一个助手放在其他地方。
谢谢。
最佳答案
显然以前有人问过这个问题(谁知道!):)。 answer是包括
helper ApplicationHelper
在 example_mailer.rb 文件中:
class ExampleMailer < ApplicationMailer
helper ApplicationHelper
...
end
关于ruby-on-rails-4 - 导轨 4 : How to use ApplicationHelper methods in mailer view,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48306947/