I have a user defined external URL that I’d like to turn into a link by using something similar to Django’s urlize filter. How might one go about doing that?
I just need something to add in the preceding http:// or whatever if it’s lacking.
Unless I missed it, link_to doesn’t seem to do that.
I can see a couple of solutions:
urlize(url)that addshttp://if it’s missinghttp://http://to the url, thus making sure that you have a valid url in your dbPersonally, I just have some validations that check that the url entered is valid. Here, I would use the 3rd option.