Reputation: 96494
the url comes from a database table, e.g. www.test.com.
How do I get a working link if that url is stored in the database (as 'web site' column).
I tried:
<%= link_to(company.web_site, company.web_site, :remote => true) %>
but I got http://localhost:3000/company_name.com and I can't seem to get rid of the localhost for the link.
Upvotes: 0
Views: 165
Reputation: 3773
Use <%= link_to(company.web_site, "http://#{company.web_site}", :remote => true) %>
Hint it with "http://" string would do the trick.
Or prepend the url with http://
or https://
in your database at the fist place also be an alternative way.
Upvotes: 1