我强烈认为这是一个愚蠢的错误,我不知何故无法看穿它。我正在尝试在我的邮件程序视图中使用这段代码。
<p><%= link_to 'here', unsubscribe_path(:email => "a@b.com") %></p>
我在路由文件中定义了一个命名路由:
map.unsubscribe '/unsubscribe', :controller => :users, :action => :unsubscribe
因此,当我发送电子邮件时,这是我得到的链接:
http://b.comonly_pathtruecontrollerusersactionunsubscribe/
有任何想法吗 ?谢谢 !
编辑
这是视图:
<html>
<body>
<p>
Hi, <br />
You have an alert for : <%= @alert.name %>. <br />
Here is some brief information about it: <br />
<%= @alert.details %><br /><br />
<br />Thank You,<br />
</p>
<p>
Click <p><%= link_to 'here', unsubscribe_path(:email => "a@b.com") %></p> to unsubscribe</p>
</body>
</html>
这是邮件:
class Alert < ActionMailer::Base
def send(alert, email)
@subject = "hi"
@recipients = "xyz@mail.com"
@from = "xyz@mail.com"
@sent_on = Time.now
@content_type = "text/html"
@alert = alert
@email = email
end
结尾