I am developing an application in Rails 3 and in this application I let the users add URLs to websites. The current problem I am facing is that some of the users forget to include the http or https prefixes which results in a non working link.
Unfortunately there seems to be no way to validate this out of the box? H开发者_运维知识库ow can I go about to validate if the submitted URL includes http?
Thankful for all help!
There is a plugin named validates_url_format_of that seems to work for Rails 3. Otherwise you can write your own custom validator.
精彩评论