我已经设法从我的 Rails 3.2 应用程序发送电子邮件 (gmail),没有明显问题。但是,电子邮件中生成的 :id 参数位置错误。
通知邮件程序
default :from => 'no-reply@someDomaiin.com'
def report_spam(comment)
@comment = comment
mail(:to => "admin@someDomaiin.com", :subject => "Inappropriate content report")
end
某些电子邮件.html.haml
Reported by:
"
= link_to @comment.reports.last.user.name, users_url(@comment.reports.last.user)
"
%p
Content of the accused comment:
%br
"
= link_to @comment.body, events_url(@comment.event.id)
"
%p
收件箱中的电子邮件看起来不错
Reported by: " saben "
Content of the accused comment:
" I just created a superb event!! "
但是,这两个链接网址是:
http://someDomaiin.heroku.com/saben/users
http://someDomaiin.heroku.com/2/events
应该是:
http://someDomaiin.heroku.com/users/saben
http://someDomaiin.heroku.com/events/2
这发生在我收到的所有/不同的邮件中。我有什么明显的遗漏吗?
提前致谢!
解决方案 :
= link_to @comment.reports.last.user.name, user_url(:id => @comment.reports.last.user.id)
"
%p
Content of the accused comment:
%br
"
= link_to @comment.body, event_url(:id => @comment.event.id)