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 'w开发者_如何学Goeb 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.
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.
精彩评论