Forum: Ruby on Rails [newbie] formatting web-link in list.rhtml

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.
C070aee7acae837b19a46a48877009a3?d=identicon&s=25 Rob R. (rvandam)
on 2006-06-14 16:18
Perhaps I need a break, but I can't find the answer for this simple
question.

I have a database which also contains an internet address. I want to
show this address with a link (wich is named link).

When I do;

<%= link_to 'link', camping.website  %> I get a clickable link. But the
destination is http://www.my_own_homepage/www.homepage.nl (what I want
is of course http://www.homepage.nl)

I have tried a lot of options, and I am already googling for hours, but
I can't get this simple task done :(
Mohit Sindhwani (Guest)
on 2006-06-14 16:24
(Received via mailing list)
rob rob wrote:
> is of course http://www.homepage.nl)
>
> I have tried a lot of options, and I am already googling for hours, but
> I can't get this simple task done :(
>
>
Not sure, but is this not a job for link_to_remote?
Cheers
Mohit
D0802a5ae80c2a40a9ef07967c6dc362?d=identicon&s=25 Mike G. (random52k)
on 2006-06-14 16:30
(Received via mailing list)
what you're doing should be correct.  Have you tried printing the
value of camping.website? Is it a string?

Mike
Mohit Sindhwani (Guest)
on 2006-06-14 16:34
(Received via mailing list)
Mohit Sindhwani wrote:
>> the destination is http://www.my_own_homepage/www.homepage.nl (what I
>> want is of course http://www.homepage.nl)
>>
>> I have tried a lot of options, and I am already googling for hours,
>> but I can't get this simple task done :(
>>
>>
> Not sure, but is this not a job for link_to_remote?
> Cheers
> Mohit
I just did some looking around and I think I've got my concepts muddled
up.. :-S
Ignore my previous message... sorry, guys!
I'm going back to the books..
Cheers
Mohit.
Rafa (Guest)
on 2006-06-14 16:40
(Received via mailing list)
rob rob escribió:
> is of course http://www.homepage.nl)
>
This change is normally done by the server because you didn't write
"http://"

> I have tried a lot of options, and I am already googling for hours, but
> I can't get this simple task done :(
>
>
Try this one:
     Concatenate to the link this string: "http://"

Bye,

                                              Rafael G.




______________________________________________
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
C070aee7acae837b19a46a48877009a3?d=identicon&s=25 Rob R. (rvandam)
on 2006-06-14 16:42
camping.website is indeed a string. When I do:

<%= link_to camping.website %> It shows the right website, but it links
to my own.

When I do:

<%= auto_link camping.website  %> It shows the right website, and it
links to the right website. I only don't have a link with the name link.
C070aee7acae837b19a46a48877009a3?d=identicon&s=25 Rob R. (rvandam)
on 2006-06-14 16:48
Rafa wrote:

> Try this one:
>      Concatenate to the link this string: "http://"
>

That works, tanks!!!

Was it wrong to use a string for this?
shai (Guest)
on 2006-06-14 17:08
no point in adding a gsub on the string would have worked to
yourstr.gsub('http://http://', 'http://')  ...or place http://www twice
etc

...either way's gooood.
cheers too.

s
This topic is locked and can not be replied to.