How to use my view helpers in my ActionMailer views?
ruby-on-rails
Solution
In the mailer class that you are using to manage your emails:
class ReportMailer < ActionMailer::Base
add_template_helper(AnnotationsHelper)
...
end
Problem
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`). How do I do this? Based on this guide it seems like the `add_template_helper(helper_module)` method might do what I want, but I can't figure out how to use it. (BTW, is there a reason you get access to a different set of helpers in mailer views? This is pretty annoying.)