开发者

Rails: change URL response format

How to easily change the format of URL in a right way:

/comment/10.js?param1=6

to

/comment/10?param1=6

Preferrably with some URL library or so, not with regexps.

Use case: redirect back with request.request_uri s开发者_StackOverflow中文版aved in session.


I'm not quite sure the use case, but the simplest way would be in the controller

respond_to do |f|
  f.js { redirect_to #copy url params, but set :format to what you actually want }
end
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜