Sorry if this question has been answered elsewhere, but I've spent awhile looking with no luck.
In my web app, I ask users to specify urls to their blogs. However, they don't always put "http://" at the beginning of these urls. Elsewhere on the site, when I link to these urls, the browser interprets them as relative urls. e.g. if the user writes bobsblog.wordpress.com, the link goes to http://www.mydomain.com/bobsblog.wordpress.com.
One solution is to pre-populate the url field with "http://".
But a nicer solution would be to parse the url and add the scheme if the user hasn't. Does rails offer a good way to do this? I looked at the function URI::parse, but it doesn't seem to offer a good way of doing that.
You could use URI.parse and check the scheme.
Here some output