RoR - make clickable links that appear in user comments

I am looking for a Ruby script that takes a piece of text and makes any links that you can click in it ... Does anyone have something like this? For example, if I wrote a comment and said: β€œCome check my site at http://www.example.com, ” then the link will be available for clicks as an html tag.

Thanks,

Josh

+3
source share
1 answer

Rails has a view helper called auto_linkfor example:

<%= auto_link("Please visit my site: http://www.example.org/") %>

will create:

Please visit my site: <a href="http://www.example.org/">http://www.example.org/</a>

Update: You can find more information about this here .

+10
source

Source: https://habr.com/ru/post/1722288/


All Articles