Created
April 30, 2014 23:09
-
-
Save BlueVajra/2a6c7dd58162c5e13d59 to your computer and use it in GitHub Desktop.
Rails Examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Url < ActiveRecord::Base | |
validates :url, presence: {message: "URL can not be blank"} | |
validates :url, format: { | |
with: /(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?/ix, | |
message: "The text you entered is not a valid URL" | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment