views:

102

answers:

1

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 saved in session.

A: 

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
Ben Hughes
can you redirect js calls?
macek