Topic: Refering to external link

Hi, I`ve seen some similar posts but they doesn`t have the same problem as me.

I want to put an external link to an anchor but Rails puts the base url before the link.
The curious thing is that it just happens when I get the link from the database.

That works fine:

<%= link_to "teste", "http://youtube.com", :only_path => true %>

But that doesn't:

<%= link_to "teste", video.link, :only_path => true %>

Any clues?

Thanks in advance!

Last edited by will_af (2012-03-01 16:16:14)

Re: Refering to external link

So your second line is outputting

http://sitename.com/http://youtube.com

Am I understanding you correctly?

Ensure that video.link starts with "http://" and let me know

Remember to edit your topic title and add "[SOLVED]" if your question has been answered!

Follow me!

Re: Refering to external link

Yes, it is exactly what is outputting.

And video.link have the http:// in the start.

Re: Refering to external link

take off the only_path option. same thing?

Remember to edit your topic title and add "[SOLVED]" if your question has been answered!

Follow me!

Re: Refering to external link

Yes, same thing.

Even if I put only_path as false or remove it.

Re: Refering to external link

I do not get this problem as long as my url starts with http://.

What version of rails are you running?

Remember to edit your topic title and add "[SOLVED]" if your question has been answered!

Follow me!

Re: Refering to external link

Yeah, it's really strange.

The version is 3.2.2