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
精彩评论