没有路线匹配?应该很简单

时间:2010-12-16 00:53:14

标签: ruby-on-rails routes ruby-on-rails-3

我一直遇到一个令人沮丧的错误 - 我有一个邮件设置,可以向新用户发送激活电子邮件。

我一直收到错误: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

我在这里缺少什么?

1 个答案:

答案 0 :(得分:0)

尝试

match 'activations/create(/:activation_code)' => 'activations#create', :as => :activate