开发者

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


  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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜