所以我得到一个“没有路由匹配”的错误,并且是 Rails 3(和一般的 Rails)的新手,我真的不知道问题是什么。以下是相关路线:
resources :users
#...
match 'reset_password(/:reset_password_code)' => 'users#reset_password', :as => :reset_password, :via => :get
match 'reset_password' => 'users#reset_password_submit', :as => :reset_password, :via => :post
GET 方法工作正常。当在获取页面上生成的表单 POST 时,我收到一个路由错误,它以这样的方式开始。
<%= form_for @user, :url => reset_password_url do |f| %>
看起来它正在发布到正确的位置,因为 url 是使用“reset_password_url”生成的,它正在发布到它,并且 url 看起来应该......有人有什么想法吗?
更新
- 我正在使用 Rails 3.0.4
- 除了我在这里提到的那些之外,我已经尝试过其他所有路线,但我仍然无法弄清楚为什么它不起作用。