如果我在一個路由別名,如/ register,我有一個表單錯誤,我渲染:新,有可能是/註冊路徑仍然可以?重定向到表單上的路由別名驗證錯誤
在它呈現的那一刻/新
我可以做一個redirect_to的register_path但隨後我就失去了PARAMS?
它讓下面的測試失敗:
Scenario: Try registering with a bad staff number
Given I am on the registration page
When I fill in "email" with "[email protected]"
And I fill in "First Name" with "Kevin"
And I fill in "last name" with "Monk"
And I fill in "Employee Number" with "something barking123"
And I press "Register"
Then I should be on the registration page
And I should see "Your employee ID number looks incorrect."
我問過類似的問題並得到答案,請參閱http:// stackoverflow。com/questions/1083798/use-custom-route-model-validation-failure – 2010-05-07 14:18:46
爲了愛上喬布斯,請糾正最後一句中的語法。您不希望您的網站出現在Error'd上。 「您的員工ID號碼看起來不正確。」 – mcandre 2010-05-25 16:50:31
哦,是啊!好點子。你的權利! – 2010-05-26 18:04:34