質問

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