# Keeping failed validations on the /new URL

**URL:** <https://www.ruby-forum.com/t/keeping-failed-validations-on-the-new-url/176393>\
**Category:** Rails\
**Created:** [September 30, 2009, 12:54am UTC](https://www.ruby-forum.com/t/keeping-failed-validations-on-the-new-url/176393 "2009-09-30T00:54:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yankees26](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/eb9ed0/32.png) [@yankees26](https://www.ruby-forum.com/u/yankees26)\
**Post date:** [September 30, 2009, 12:54am UTC](https://www.ruby-forum.com/t/keeping-failed-validations-on-the-new-url/176393/1 "2009-09-30T00:54:50Z")

</div>

When I follow the standard:

if @object.save  
redirect\_to wherever  
else  
render :action =\> “new”  
end

this changes the URL from /object/new to /object

I want it to stay at /object/new

thanks

---

<div class="post-metadata">

**Author:** ![yankees26](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/eb9ed0/32.png) [@yankees26](https://www.ruby-forum.com/u/yankees26)\
**Post date:** [September 30, 2009, 3:38am UTC](https://www.ruby-forum.com/t/keeping-failed-validations-on-the-new-url/176393/2 "2009-09-30T03:38:48Z")

</div>

That’s just not how Rails works. Your form posted to the Create action,  
which is /object (and probably more likely objects/) and if you redirect  
you  
lose the errors. You should ask yourself “Why does the URL matter?”  
Your  
users will be focused on filling in the correct info, not the URL. Make  
your  
forms clear and most of your users won’t even see the errors on the form  
at  
all.

Using separate actions for new and create solves several other problems  
that  
you may not yet notice. First, no branching logic to handle postbacks,  
and  
second, a redirection away after a successful create prevents accidental  
duplications on refresh.

Embrace the way Rails does things, and get your customers the features  
they  
want. Best of luck to you.

On Tue, Sep 29, 2009 at 5:54 PM, Joao S. \<
