Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #11466 (new defect)

Opened 2 months ago

Last modified 1 month ago

page.redirect_to issue for Firefox 2.0.0.12

Reported by: anildigital Assigned to: core
Priority: normal Milestone: 2.x
Component: ActionPack Version: edge
Severity: normal Keywords:
Cc:

Description

Whenever I do page.redirect_to params in RJS where params has additional params other than :id, like :city, :state. It returns a query string which has & for all the &. e.g. http://localhost:3000/home/next?&city=Pune&state=MH. As per web standards & is correct instead of &. (To avoid problems with both validators and browsers, always use & in place of & when writing URLs in HTML). But FF 2.0.0.12 does not support &. And many people believe if FF does not support, it is not a web standard. The urls with & does not get properly parsed in rails. like for above url, we expect there is params[:city] but rails is making it to params[&city]. One solution can be, if browsers pass & instead of &, rails should be able to understand it as & and fill params[:city] with city as key not &city as key.

I tried to write a test for above problem, and you could see http://pastie.org/pastes/17277 test fails. I could not find the reason why is it failing.

Change History

03/30/08 18:33:21 changed by anildigital

huh, wrong pastie link! correct link is http://pastie.org/pastes/172774

04/06/08 19:34:46 changed by anildigital

04/08/08 08:54:14 changed by seebq

Whenever I'm building links to be passed to javascript on the page, I use the url_for() helper and explicitly tell it not to escape:

url_for({:controller => 'widgets', :action => 'show', :id => @widget}, :escape => false)

The default is true.

See the API docs for url_for: http://api.rubyonrails.com/classes/ActionView/Helpers/UrlHelper.html#M000912

Does this help?