-
Notifications
You must be signed in to change notification settings - Fork 0
Add url format validator #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
lib/validates_url_format/version.rb
Outdated
| @@ -0,0 +1,3 @@ | |||
| module ValidatesUrlFormat | |||
| VERSION = '0.0.1' | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| VERSION = '0.0.1' | |
| VERSION = '0.1.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
lib/validates_url_format.rb
Outdated
| DEFAULT_SCHEMES = %w(http https) | ||
|
|
||
| def initialize(options) | ||
| options.reverse_merge!(messages: DEFAULT_MESSAGES, no_local: false, public_suffix: false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class Model < OpenStruct
include ActiveModel::Validations
validates_url_format_of :url, allow_blank: false, allow_nil: true, no_local: true, messages: { invalid_url: 'ABOBA'}
end
options.reverse_merge!(messages: DEFAULT_MESSAGES, no_local: false, public_suffix: false)
=> {:messages=>{:invalid_url=>"ABOBA"}, :no_local=>true, :public_suffix=>false, :allow_blank=>false, :allow_nil=>true, :attributes=>[:url], :class=>Model}messages как-то смерджились не так
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
No description provided.