Forum: Ruby on Rails Is there a link_to 'external url'?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Lindsay B. (Guest)
on 2006-05-02 19:02
I've checked the Rails documentation but find no mention of link_to
'external url' or equivalent. Does rails have a built in method to do
this?

thanks
-Lindsay
David (Guest)
on 2006-05-02 19:09
Lindsay B. wrote:
> I've checked the Rails documentation but find no mention of link_to
> 'external url' or equivalent. Does rails have a built in method to do
> this?

http://lists.rubyonrails.org/pipermail/rails/2006-...

Google saves the day.
Lindsay B. (Guest)
on 2006-05-02 19:40
David wrote:
>
> Google saves the day.

Cheers David. That's good to know.

When I apply this to my app I now have a new problem: my app allows
users to enter URLs with or without an 'http://'. When the URLs are
displayed, I want them to be linkable, so I can use link_to, but I have
to check to see if 'http://' is present. So, looks like I will have to
write my own method.

thanks
-Lindsay
Tom W. (Guest)
on 2006-05-03 20:59
(Received via mailing list)
link_to "Google", "http://www.google.com"

Tom
Dave S. (Guest)
on 2006-05-03 20:59
(Received via mailing list)
On Tuesday 02 May 2006 16:02, Lindsay B. wrote:
> I've checked the Rails documentation but find no mention of link_to
> 'external url' or equivalent. Does rails have a built in method to do
> this?

<%= link_to "Click here to visit my site", "http://www.example.com/" -%>

~Dave

--

Dave S.
Rent-A-Monkey Website Development
http://www.rentamonkey.com/

PGP Key: http://www.rentamonkey.com/pgpkey.asc
Wilson B. (Guest)
on 2006-05-03 20:59
(Received via mailing list)
Charlie B. (Guest)
on 2006-05-03 20:59
(Received via mailing list)
Just out of curiosity, why would you use the link_to helper for an
external url?

Charlie B.
www.recentrambles.com
This topic is locked and can not be replied to.