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.

[Rails 3] Routes redirect method doesn't support URLs

#3653

The redirect method does not take ports into account. So if I am running on localhost:3000, this redirects to localhost/logout rather than localhost:3000/logout.

match 'account/logout' => redirect("/logout") # I don't really know how to test with URL with ports, so failing test not included in patch.

The redirect below also doesn't work with arguments that contain protocols, such as:

  match 'account/google' => redirect("http://www.google.com/")

This redirects to http://localhosthttp://www.google.com/. I don't know if redirects aren't supposed to support these or not.

I've attached a patch with a failing test for urls in redirect. It applies cleanly on master.

Reported by Rizwan Reza · January 4th, 2010 @ 09:27 PM

State: resolved
Milestone: 3.0.2
Assigned to: josh josh
Importance: none

Activity

  1. josh
    josh
    • State changed from new to open
    • Assigned user set to josh
    • Milestone cleared.

    January 5th, 2010 @ 04:32 PM

  2. Repository
    Repository
    • State changed from open to resolved

    January 5th, 2010 @ 06:01 PM

  3. Rizwan Reza
    Rizwan Reza

    Well done.

    Though, I don't think it addresses the handling of ports in the URL.

    January 5th, 2010 @ 07:16 PM

  4. Repository
  5. Rizwan Reza
    Rizwan Reza
    • Tag changed from patch, rails3, review, router to patch, rails3, resolved, review, router

    Thanks!

    January 6th, 2010 @ 12:05 AM

  6. Jeremy Kemper