Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 如何在电子邮件模板中使用应用程序助手方法_Ruby On Rails 4_Actionmailer - Fatal编程技术网

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
类中