开发者

How to get rails3 to do remote link using database info

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜