This project is archived and is in readonly mode.
Using redirect_to with params merge of protocol doesn't take effect
Reported by Kieran P | July 9th, 2009 @ 01:09 AM | in 2.x
redirect_to params.merge(:protocol => 'https')
Pretty simple. But it doesn't work. Somewhere along the lines, the hash gets converted to string keys, so when it reaches rewrite_url, and tries to access options[:protocol] it doesn't exist (only options['protocol'] does). This despite passing in an initial symbol.
Quickest fix I've found is attached in a patch to this ticket.
Comments and changes to this ticket
-
Kieran P August 7th, 2009 @ 11:55 AM
Quick update: This is not a problem in Rails 3.0 (just tested on latest master) and wasn't a problem in Rails 2.1. So it seems to only affect the 2.3 branch.
-
José Valim August 8th, 2009 @ 01:52 PM
- Tag changed from 2-3, bug, issue, protocol, redirect_to to 2-3, bug, bugmash, issue, protocol, redirect_to
-
Edd Morgan August 8th, 2009 @ 05:58 PM
Not reproducible. Following tests passed:
class RedirectController < ActionController::Base def redirect_with_protocol redirect_to :controller => "things", :action => "stuff", :protocol => "https" end end class RedirectTest < ActionController::TestCase tests RedirectController def test_redirect_with_protocol get :redirect_with_protocol assert_response :redirect assert_equal "https://test.host/things/stuff", redirect_to_url end end
-
Dan Pickett August 8th, 2009 @ 08:16 PM
Not reproducible - verified Edd Morgan's tests pass on 2-3-stable
-
Dan Croak August 8th, 2009 @ 08:43 PM
- Assigned user set to Pratik
Attached a passing 2-3-stable patch that is a test ensuring redirect_to uses the given protocol.
-
Pratik August 8th, 2009 @ 08:52 PM
- Tag changed from 2-3, bug, bugmash, issue, protocol, redirect_to to 2-3, bug, issue, protocol, redirect_to
-
Repository August 9th, 2009 @ 05:05 AM
(from [00544c778f53b034bf4560548479a20a06d5c22d]) Add test ensuring redirect_to uses the given protocol [#2886]
Signed-off-by: Pratik Naik pratiknaik@gmail.com
http://github.com/rails/rails/commit/00544c778f53b034bf4560548479a2... -
Andrea Campi October 16th, 2010 @ 11:57 PM
- Tag changed from 2-3, bug, issue, protocol, redirect_to to 2-3-stable, bug, issue, protocol, redirect_to
- Importance changed from to
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 2886 Using redirect_to with params merge of protocol doesn't take effect (from [00544c778f53b034bf4560548479a20a06d5c22d]) Add tes...