I recently migrated old data from a news site into a new platform built using Ruby on Rails. Mostly seamless migration except for one thing that I have not been able to figure out.
Inside the body of the articles there are 'a tags'. These urls do not have an http or https on them. they start with www.
<a href="www.exampleurl.com">www.exampleurl.com</a>
I know that if I were to prepend these with the 'http://' they would go to the correct place. As they are now however, they generate this in the view:
localhost:3000/articles/www.exampleurl.com
It would not be practical to go back through 150,000 articles to check the body and see if they have an 'a tag' without the 'http://'. Is there a way to change this functionality in Rails so that when we display the body using
article.body.html_safe
it displays the body with the absolute url in the middle of it rather than the relative url? If one exists of course.