Ruby on rails 4 如何在电子邮件模板中使用应用程序助手方法
我在Ruby on rails 4 如何在电子邮件模板中使用应用程序助手方法,ruby-on-rails-4,actionmailer,Ruby On Rails 4,Actionmailer,我在ApplicationHelper中定义了一个助手: module ApplicationHelper def url_for_portal URI("https://example.com/") end end 并希望在邮件模板中使用它,app/views/client\u mailer/account\u activation.md.erb,但获得一个未定义的方法“url\u for\u portal”: Activate your Example.com accoun
ApplicationHelper
中定义了一个助手:
module ApplicationHelper
def url_for_portal
URI("https://example.com/")
end
end
并希望在邮件模板中使用它,app/views/client\u mailer/account\u activation.md.erb
,但获得一个未定义的方法“url\u for\u portal”
:
Activate your Example.com account by clicking on the link below:
[<%= url_for_portal %>](<%= url_for_portal %>)
点击下面的链接激活您的Example.com帐户:
[]()
如何在邮件模板中编写和使用帮助器方法?将
helper:application
添加到ClientMailer
类。将helper:application
添加到ClientMailer
类中