Using helper method from action mailer views

Action Mailer of Ruby on Rails(RoR) allows you to send emails from application using a mailer model and views. Sometimes you may need to use any helper method though it does not allow by default. In that case you have to include helper(module) in the Mailer class.

Say, you may need to use method(s) from ProductsHelper module, then you need to write following line in the Mailer file which will provide accessibility to use all methods written in ProductsHelper

add_template_helper(ProductsHelper)

Cheers!!

Leave a Comment