# Restful paths for rails - when error occurs

**URL:** <https://www.ruby-forum.com/t/restful-paths-for-rails-when-error-occurs/162335>\
**Category:** Rails\
**Created:** [March 8, 2009, 8:35pm UTC](https://www.ruby-forum.com/t/restful-paths-for-rails-when-error-occurs/162335 "2009-03-08T20:35:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dhana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@Dhana](https://www.ruby-forum.com/u/Dhana)\
**Post date:** [March 8, 2009, 8:35pm UTC](https://www.ruby-forum.com/t/restful-paths-for-rails-when-error-occurs/162335/1 "2009-03-08T20:35:36Z")

</div>

I have a question specific question on rails when error happens. I  
have a SessionsController that takes care of the user logging in and  
logging out using the restful actions “new” and “destroy”. Since I  
want the path to be user friendly, I mapped the resource to this

map.login “/login”, :controller =\> “sessions”, :action =\> “new”  
map.logout “/logout”, :controller =\> “sessions”, :action =\> “destroy”

The resources above works fine for the two paths. But what I’ve  
noticed is when errors occur (when the action is being rendered).  
Then in that case, instead of the path on the browser that say /login,  
it would say /session. Is there a way to override it. The page works  
fine, but I just don’t like how the url changes. I also got this same  
issue with scaffolded resources. For example, when I purposefully  
triggered errors in a “products/new” action, the path on the address  
bar changes to /products, but the new form is still there.

Any way to avoid this?
