views:

64

answers:

1

I am looking for a Ruby 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

+6  A: 

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/"&gt;http://www.example.org/&lt;/a&gt;

Update: You can find more information about it here.

Tomas Markauskas