开发者

RoR - make links clickable that show up in a user comment

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜