Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Using redirect_to with params merge of protocol doesn't take effect

#2886

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.

Reported by Kieran P · July 9th, 2009 @ 01:09 AM

State: invalid
Milestone: 2.x
Assigned to: Pratik Pratik
Importance: none

Activity

  1. Kieran P
    Kieran P

    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.

    August 7th, 2009 @ 11:55 AM

  2. José Valim
    José Valim
    • Tag changed from 2-3, bug, issue, protocol, redirect_to to 2-3, bug, bugmash, issue, protocol, redirect_to

    August 8th, 2009 @ 01:52 PM

  3. Edd Morgan
    Edd Morgan

    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
    

    August 8th, 2009 @ 05:58 PM

  4. Dan Pickett
    Dan Pickett

    Not reproducible - verified Edd Morgan's tests pass on 2-3-stable

    August 8th, 2009 @ 08:16 PM

  5. Dan Croak
    Dan Croak
    • Assigned user set to Pratik

    Attached a passing 2-3-stable patch that is a test ensuring redirect_to uses the given protocol.

    August 8th, 2009 @ 08:43 PM

  6. Pratik
    Pratik
    • State changed from new to invalid

    Pushed the test to master.

    August 8th, 2009 @ 08:52 PM

  7. Pratik
    Pratik
    • Tag changed from 2-3, bug, bugmash, issue, protocol, redirect_to to 2-3, bug, issue, protocol, redirect_to

    August 8th, 2009 @ 08:52 PM

  8. Repository
  9. Andrea Campi
    Andrea Campi
    • Tag changed from 2-3, bug, issue, protocol, redirect_to to 2-3-stable, bug, issue, protocol, redirect_to
    • Importance changed from to

    October 16th, 2010 @ 11:57 PM