I am developing a rails app that allows users to post, very similar to a forum. If a user types a link in, I want that link to become an element when it is printed to the page. For example, pretend this was a user post:
"I love this new website www.newwebsite.com!"
I want the above string to be printed to the page as:
I love this new website <a href="www.newwebsite.com">www.newwebsite.com</a>
Are there any rails helpers, gems, or built-in modules to accomplish this?
Check out rails_autolink for this. If you’re using a version of Rails prior to 3.1, this functionality is built-in and you don’t need the gem.