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 :( -- Posted via http://www.ruby-forum.com/.
rob rob wrote:> 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 :( > >Not sure, but is this not a job for link_to_remote? Cheers Mohit
what you''re doing should be correct. Have you tried printing the value of camping.website? Is it a string? Mike On 6/14/06, rob rob <robvandam@zonnet.nl> wrote:> 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 :( > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Mohit Sindhwani wrote:> rob rob wrote: >> 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 :( >> >> > Not sure, but is this not a job for link_to_remote? > Cheers > MohitI 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.
rob rob escribió:> 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) >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
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. -- Posted via http://www.ruby-forum.com/.
Rafa wrote:> Try this one: > Concatenate to the link this string: "http://" >That works, tanks!!! Was it wrong to use a string for this? -- Posted via http://www.ruby-forum.com/.
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 -- Posted via http://www.ruby-forum.com/.