문제

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?

도움이 되었습니까?

해결책

Add helper :application to your ClientMailer class.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top