I know it’s supposed to be easy, but I just can’t figure out how to modify an existing auto_html filter to get the output I need. I found this Creating filters for auto_html
but I need to modify an existing filter.
for example, I have a list of youtube links in the db in this format (http://youtu.be/UfQC1h-EANI) and printed out in my view:
%li
= link_to link.title, link.url, :class => "youtube title_link"
When the the link is clicked, I need the http://youtu.be/UfQC1h-EANI converted to http://www.youtube.com/embed/UfQC1h-EANI?rel=0
I’ve managed to get a conversion working using auto_html, however, it’s coming with all of the html attached to it. I’m thinking if I can modify the filter, I can adjust it to just give me the url without all the html. I can’t for the life of me figure out how to modify auto_html’s youtube filter. Is this even the best approach for this?
Any help is muchly appreciated!
Just do it with regex
If you want it
onclickonly, you can do it in JavaScript.