1
解决了其他problem with routes后,现在我有另一个。Rails 3路由问题
我在routes.rb中这条路线:
match "user/create_new_password/:reset_password_key" =>"users#create_new_password", :via=>[:post, :get], :as=>:create_new_password
我可以测试它在我的功能测试是这样的:
test "should create new password " do
post :create_new_password, {:user=>{:password=>"123456", :password_confirmation=>"123456"}, :reset_password_key=>user.reset_password_key}
end
在我看来,我有以下形式:
=simple_form_for @user, :url=>create_new_password_path do |f|
=f.input :password, :label=>I18n.t("activerecord.attributes.user.email")
=f.input :password_confirmation, :label=>I18n.t("activerecord.attributes.user.password_confirmation")
=f.submit I18n.t "activerecord.actions.user.create_new_password"
当我提交表单,我得到:
No route matches "/user/create_new_password/OqQxYTgjYKxXgvbAsTsWtMnIpMOpsjCRzLGZmJZLSbYtjvcvdpO"
大字符串是reset_password_key。
我已经在功能测试中用reset_password_key的相同值对它进行了测试。
进行耙路线相关的输出是:
create_new_password POST|GET /user/create_new_password/:reset_password_key(.:format) {:controller=>"users", :action=>"create_new_password"}
我失去了一些东西......
不得不问:你开始,因为编辑路由服务器?如果是这样,你可以发布你的`config/routes.rb`文件的内容吗?谢谢,祝你好运! – 2011-02-10 00:06:04