views:

16

answers:

1

I have a text area into which users enter a lot of text that potentially includes hyperlinks. How can I display the text and have the URLs automatically appear as hyperlinks? Is there a gem, plugin, or existing method that does this? I'm looking to be able to do something like:
<%=h @my_object.description.with_links %> in my view.

+2  A: 

Rails has a helper method called auto_link. Which is part of ActionPack.

In your case you could do this:

<%=h auto_link(@my_object.description) %>
Joseph Silvashy
Thank you very much!
Clay