我试图在我的用户欢迎电子邮件中提供确认链接,但我收到以下 Rails 错误:
Need controller and action!
它对这一行大惊小怪:
<p>Please take a moment to activate your account by going to:
<%= link_to confirm_user_url(:id => @user.confirmation_code) %>.</p>
在我的development.rb
环境中,我有以下行:
config.action_mailer.default_url_options = {
:host => "localhost", :port => 3000
}
@user
变量没有问题。@user.username
我已经用和之类的东西测试了电子邮件@user.confirmation_code
。我只是遇到麻烦url_for
并命名为confirm_user_url
.
当我检查我的路线时rake routes
,confirm_user
会出现,因此命名路线不存在不是问题。
我似乎无法弄清楚。是什么赋予了?