Skip to content

Conversation

@uragap
Copy link
Owner

@uragap uragap commented Jan 10, 2022

No description provided.

@@ -0,0 +1,3 @@
module ValidatesUrlFormat
VERSION = '0.0.1'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
VERSION = '0.0.1'
VERSION = '0.1.0'

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

DEFAULT_SCHEMES = %w(http https)

def initialize(options)
options.reverse_merge!(messages: DEFAULT_MESSAGES, no_local: false, public_suffix: false)

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 как-то смерджились не так

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants