我正在尝试生成一个人可以在电子邮件中单击的取消订阅链接。这是我的路线的样子:
match "/unsubscribe/:email/:token" => "mailing_list_recipients#destroy", :as => :unsubscribe
当我运行时rake routes
,我得到:
unsubscribe GET /unsubscribe/:email/:token(.:format) mailing_list_recipients#destroy
我什至可以这样做:
unsubscribe_url(mailing_list_recipient.email, mailing_list_recipient.token)
输出:
http://localhost:3000/unsubscribe/hello@hello.com/f99e3af9bd959c6c8f3882a6e10e354e
但是,当我尝试访问此 URL 时,出现以下错误:
No route matches [GET] "/unsubscribe/schroppl@gmail.com/6458f6a714d81a9cdd1cd1133dd65f0d"
我错过了什么?