Frage

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?

War es hilfreich?

Lösung

Add helper :application to your ClientMailer class.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top