No route matches? Should be simple
I keep running into an error that is becoming quite frustrating - I have a Mail setup t开发者_开发百科hat sends out an activation e-mail to new users.
I keep getting the error: no route matches {:controller => "activations", :action => "create"}
Here's the code:
# 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
What am I missing here?
Try
match 'activations/create(/:activation_code)' => 'activations#create', :as => :activate
精彩评论