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.

link_to with single string argument

#566

Currently, calling the link_to helper method with a single string argument generates a link with the given string as the link text and the current URL as the linked URL. This patch makes it so that the given string is used as both the link text and the link URL. In other words,

link_to("http://www.rubyonrails.org")

will now generate the following link:

http://www.rubyonrails.org

Reported by David Eisinger · July 7th, 2008 @ 06:14 PM

State: wontfix
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Ryan Bates
    Ryan Bates

    You can use auto_link for this.

    auto_link "http://www.rubyonrails.org"
    

    That probably isn't as efficient performance wise, so I would still like to see this patch accepted.

    July 7th, 2008 @ 09:48 PM

  2. Chris Barnett
    Chris Barnett

    I think this is a good idea, but I'm not sure about the implementation.

    I've always been able to do

    <%= link_to "Somewhere" %>
    

    To create a placeholder for a real link which will be added later. It renders as:

    <a href="/path/to/the/current/page">Somewhere</a>
    

    This is great for mocking up a page; but with this patch applied, the same link_to becomes:

    <a href="Somewhere">Somewhere</a>
    

    Placeholder links will now give 404 errors instead of just reloading the page.

    Is anyone else using link_to this way?

    July 8th, 2008 @ 04:58 AM

  3. Pratik
    Pratik
    • State changed from new to wontfix

    Should just use auto_link.

    August 3rd, 2008 @ 02:31 PM