redirect to a route alias on a form validation error

Posted by Kevin Monk on Stack Overflow See other posts from Stack Overflow or by Kevin Monk
Published on 2010-05-07T12:06:51Z Indexed on 2010/06/08 23:52 UTC
Read the original article Hit count: 466

Filed under:
|

If I'm on a route alias such as /register and I have a form error and I render :new, is it possible for the path to be /register still?

At the moment it is rendering /new

I could do a redirect_to register_path but then I would lose the params?

It's making the following test fail:

  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."

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about cucumber