How to use my view helpers in my ActionMailer views?

后端 未结 7 1757
清酒与你
清酒与你 2020-11-30 18:17

I want to use the methods I defined in app/helpers/annotations_helper.rb in my ReportMailer views (app/views/report_mailer/usage_report.text.html.erb

7条回答
  •  星月不相逢
    2020-11-30 18:41

    In the mailer class that you are using to manage your emails:

    class ReportMailer < ActionMailer::Base
      add_template_helper(AnnotationsHelper)
    
      ...
    end
    

提交回复
热议问题