我一直遇到一个令人沮丧的错误 - 我有一个邮件设置,可以向新用户发送激活电子邮件。
我一直收到错误:no route matches {:controller => "activations", :action => "create"}
以下是代码:
# routes. I tried all of these individually.
match 'activations/create'
match 'activations/create/:activation_code' => 'activations#create', :as => :activate
match 'activate/:activation_code' => 'activations#create', :as => :activate
# controller. This is the line that refers to UserMailer, that then causes the error.
UserMailer.activation_instructions(@user).deliver
# UserMailer.rb
def activation_instructions(user)
@user = user
@account_activation_url = activate_url(user.perishable_token) # error raised here
mail(:to => "#{user.login} <#{user.email}>", :subject => "Registered" )
end
我在这里缺少什么?
答案 0 :(得分:0)
尝试
match 'activations/create(/:activation_code)' => 'activations#create', :as => :activate