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.

url_for does not automatically :only_path => false when :host is set

#6500

Docs claim otherwise.

Reported by Evan Light · March 2nd, 2011 @ 12:18 AM

State: invalid
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Evan Light
    Evan Light

    Specifically, docs for url_for claim :only_path defaults to false. However, setting :host without explicitly specifying :only_path => false results in a relative url.

    That is:

    url_for foo, :host => "bla.com"
    

    ... provides a relative path but ...

    url_for foo, :host => "bla.com", :only_path => false
    

    ... provides an absolute path.

    March 2nd, 2011 @ 12:32 AM

  2. Evan Light
    Evan Light

    Er... replace "foo" with a controller and action. ;-)

    March 2nd, 2011 @ 12:40 AM

  3. Evan Light
    Evan Light

    More specifically, this only happens when using a named route helper. Using url_for directly works fine.

    March 2nd, 2011 @ 12:47 AM

  4. Evan Light
    Evan Light

    Please close this. Not a bug. Perhaps the documentation could use an update to remind people that url defaults to :only_path => false and path defaults to :only_path => true.

    March 2nd, 2011 @ 01:17 AM

  5. Andrew White
    Andrew White
    • State changed from new to invalid
    • Importance changed from to Low

    March 3rd, 2011 @ 05:58 PM