开发者

How to get desired routes for forms

开发者 https://www.devze.com 2023-03-19 05:29 出处:网络
I will start by example. Example: There is a form with /profile/edit, and it gets /users after clicking submit in web browser.

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)?


  1. In your update action, use redirect_to :back or redirect_to :action => :edit
  2. 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.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号