Problem in link_to


#1

Hi. I am developing a Personal Blog using Rails. In Comment model, i
have a database field called “website”, which people who comment on an
article may use it to add their website. Its working good. But in the
“show” view of an article, the website link in the comments section is
displayed as http://localhost:3000/articles/www.someuser.com and if i
click it shows a Page not found error.

The code i used is

<% link_to ‘comment.website’, 'comment.website %>

Someone please solve this issue. Thanks in advance.


#2

If you want to link to an external address the string must be appended
by protocol you are using (http:// , ftp://)

i.e.

<%= link_to “www.google.com”, “http://www.google.com” %>


#3

Thank you Adams. Problem solved