How to get desired routes for forms
I will start by example.
Example: There is a form with /profile/edit, and it gets /users after clicking submit in web browser.
What I want, is to make开发者_如何学运维 that, when someone clicks submit for form, it gets exactly the same URL, as it was (/profile/edit for the example).
How that can be done nicely?
P.S. By the way. Is it possible to use localization for Rails' routes (by example again: from this -> /profile/edit, to -> /profil/modifier)?
- In your update action, use
redirect_to :back
orredirect_to :action => :edit
- There are gems for i18nizing routes: i18n_routing and translate_routes. I haven't used them, but I think they'll let you get started.
精彩评论