validate_as_url 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/validate_as_url.rb +4 -4
- data/validate_as_url.gemspec +1 -1
- metadata +1 -1
data/lib/validate_as_url.rb
CHANGED
@@ -47,7 +47,7 @@ module ValidateAsUrl
|
|
47
47
|
options.update(attr_names.pop) if attr_names.last.is_a?(Hash)
|
48
48
|
|
49
49
|
validates_each(attr_names, options) do |record, attr_name, value|
|
50
|
-
errors = ValidateAsUrl::validate_as_url(value.to_s, options)
|
50
|
+
errors = ::ValidateAsUrl::validate_as_url(value.to_s, options)
|
51
51
|
errors.each do |error|
|
52
52
|
record.errors.add(attr_name, error)
|
53
53
|
end unless errors.nil?
|
@@ -59,7 +59,7 @@ end
|
|
59
59
|
if defined?(ActiveModel)
|
60
60
|
class AsUrlValidator < ActiveModel::EachValidator
|
61
61
|
def validate_each(record, attribute, value)
|
62
|
-
err = ValidateAsUrl::validate_as_url(value, options)
|
62
|
+
err = ::ValidateAsUrl::validate_as_url(value, options)
|
63
63
|
unless err.nil?
|
64
64
|
record.errors[attribute] << err
|
65
65
|
record.errors[attribute].flatten!
|
@@ -69,13 +69,13 @@ if defined?(ActiveModel)
|
|
69
69
|
|
70
70
|
module ActiveModel::Validations::HelperMethods
|
71
71
|
def validate_as_url(*attr_names)
|
72
|
-
validates_with AsUrlValidator, _merge_attributes(attr_names)
|
72
|
+
validates_with ::AsUrlValidator, _merge_attributes(attr_names)
|
73
73
|
end
|
74
74
|
end
|
75
75
|
else
|
76
76
|
if defined?(ActiveRecord)
|
77
77
|
class ActiveRecord::Base
|
78
|
-
extend AsUrlValidator::Validations
|
78
|
+
extend ::AsUrlValidator::Validations
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
data/validate_as_url.gemspec
CHANGED