I am looking for a Ruby开发者_StackOverflow script that takes a piece of text, and makes any links click-able that show up in it... Does anyone have something like this? For example, if I wrote a comment and said "Come check out my site at http://www.example.com", then the link would be click-able like an html tag.
Thanks,
Josh
Rails has a View helper called auto_link
, e.g.:
<%= auto_link("Please visit my site: http://www.example.org/") %>
would produce:
Please visit my site: <a href="http://www.example.org/">http://www.example.org/</a>
Update: You can find more information about it here.
精彩评论