Add helper :application
to your ClientMailer
class.
How to use an application helper method in an email template
-
09-10-2022 - |
题
I have defined a helper in the ApplicationHelper
:
module ApplicationHelper
def url_for_portal
URI("https://example.com/")
end
end
And want to use it in a mail template, app/views/client_mailer/account_activation.md.erb
, but get an undefined method 'url_for_portal'
:
Activate your Example.com account by clicking on the link below:
[<%= url_for_portal %>](<%= url_for_portal %>)
How can I write and use helper methods in mail templates?
解决方案
不隶属于 StackOverflow