flash_validators 3.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/flash_validators/matchers/ensure_valid_alpha_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_alpha_numeric_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_base64_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_boolean_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_credit_card_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_currency_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_cusip_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_email_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_equality_matcher_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_gtin_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_hex_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_imei_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_ip_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_isbn_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_isin_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_latitude_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_longitude_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_mac_address_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_name_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_password_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_phone_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_sedol_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_slug_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_ssn_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_url_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_username_format_of.rb +1 -1
- data/lib/flash_validators/matchers/ensure_valid_uuid_format_of.rb +1 -1
- data/lib/flash_validators/validators/alpha_numeric_validator.rb +1 -1
- data/lib/flash_validators/validators/alpha_validator.rb +1 -1
- data/lib/flash_validators/validators/base64_validator.rb +1 -1
- data/lib/flash_validators/validators/boolean_validator.rb +1 -1
- data/lib/flash_validators/validators/credit_card_validator.rb +1 -1
- data/lib/flash_validators/validators/currency_validator.rb +1 -1
- data/lib/flash_validators/validators/cusip_validator.rb +1 -1
- data/lib/flash_validators/validators/email_validator.rb +1 -1
- data/lib/flash_validators/validators/equality_validator.rb +1 -1
- data/lib/flash_validators/validators/gtin_validator.rb +1 -1
- data/lib/flash_validators/validators/hex_validator.rb +1 -1
- data/lib/flash_validators/validators/imei_validator.rb +1 -1
- data/lib/flash_validators/validators/ip_validator.rb +1 -1
- data/lib/flash_validators/validators/isbn_validator.rb +1 -1
- data/lib/flash_validators/validators/isin_validator.rb +1 -1
- data/lib/flash_validators/validators/latitude_validator.rb +1 -1
- data/lib/flash_validators/validators/longitude_validator.rb +1 -1
- data/lib/flash_validators/validators/mac_address_validator.rb +1 -1
- data/lib/flash_validators/validators/name_validator.rb +1 -1
- data/lib/flash_validators/validators/password_validator.rb +1 -1
- data/lib/flash_validators/validators/phone_validator.rb +1 -1
- data/lib/flash_validators/validators/sedol_validator.rb +1 -1
- data/lib/flash_validators/validators/slug_validator.rb +1 -1
- data/lib/flash_validators/validators/ssn_validator.rb +1 -1
- data/lib/flash_validators/validators/url_validator.rb +1 -1
- data/lib/flash_validators/validators/username_validator.rb +1 -1
- data/lib/flash_validators/validators/uuid_validator.rb +1 -1
- data/lib/flash_validators/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1eb3d9475a1a0e3d2a0bcb854ce4c6af6179731
|
4
|
+
data.tar.gz: 07119e9a47963707d84812ac18155df421964907
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 664c566b3587fe6368406ef69b1674b76f5b6bf1ef569f620220815f64922114df9af71e1a8853c708574a95bec97487b6375f6fa86b03609ff734c5272770ef
|
7
|
+
data.tar.gz: 9837062848e3d77ab6c57ff3834af42b3d46c9b5e99e606f0c6556334677df30367637a2929c54ec7ef35b2a00938fe819679fcf834000fd084c1bcdc2d1827d
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_alpha_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.alpha'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.alpha'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_alpha_numeric_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.alpha_numeric'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.alpha_numeric'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_base64_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.base64'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.base64'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_boolean_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.boolean'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.boolean'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_credit_card_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.credit_card'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.credit_card'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_currency_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.currency'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.currency'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_cusip_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.cusip'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.cusip'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_email_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.email'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.email'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -16,7 +16,7 @@ RSpec::Matchers.define :ensure_equality_of do |attribute|
|
|
16
16
|
model.valid?
|
17
17
|
|
18
18
|
if model.errors.has_key?(attribute)
|
19
|
-
model.errors[attribute].include?(I18n.t('errors.messages.equality', attr: @to, operator: @operator))
|
19
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.equality', attr: @to, operator: @operator))
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_gtin_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.gtin'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.gtin'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_hex_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.hex'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.hex'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_imei_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.imei'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.imei'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_ip_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.ip'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.ip'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_isbn_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.isbn'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.isbn'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_isin_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.isin'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.isin'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_latitude_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.latitude'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.latitude'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_longitude_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.longitude'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.longitude'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_mac_address_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.mac_address'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.mac_address'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_name_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.name'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.name'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_password_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.password'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.password'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_phone_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.phone'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.phone'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_sedol_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.sedol'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.sedol'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_slug_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.slug'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.slug'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_ssn_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.ssn'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.ssn'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_url_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.url'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.url'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_username_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.username'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.username'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ RSpec::Matchers.define :ensure_valid_uuid_format_of do |attribute|
|
|
4
4
|
model.valid?
|
5
5
|
|
6
6
|
if model.errors.has_key?(attribute)
|
7
|
-
model.errors[attribute].include?(I18n.t('errors.messages.uuid'))
|
7
|
+
model.errors[attribute].include?(I18n.t('flash_validators.errors.messages.uuid'))
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -2,7 +2,7 @@ class AlphaNumericValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless valid?(value, options)
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.alpha_numeric'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.alpha_numeric'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class AlphaValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless valid?(value, options)
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.alpha'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.alpha'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class Base64Validator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless value =~ /^(?:[A-Za-z0-9+$]{4})*(?:[A-Za-z0-9+$]{2}==|[A-Za-z0-9+$]{3}=|[A-Za-z0-9+$]{4})$/
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.base64'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.base64'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class BooleanValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless [true, false, 1, 0].include?(value)
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.boolean'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.boolean'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class CreditCardValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless valid?(value, options)
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.credit_card'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.credit_card'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class CurrencyValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless valid?(value, options)
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.currency'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.currency'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class CusipValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless valid?(value.to_s)
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.cusip'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.cusip'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class EmailValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless valid?(value, options)
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.email'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.email'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -9,7 +9,7 @@ class EqualityValidator < ActiveModel::EachValidator
|
|
9
9
|
end
|
10
10
|
|
11
11
|
unless value.send(operator, record.send(to_value.to_sym))
|
12
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.equality', attr: to_value, operator: operator))
|
12
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.equality', attr: to_value, operator: operator))
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -2,7 +2,7 @@ class GtinValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless valid?(value, options)
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.gtin'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.gtin'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class HexValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless value =~ /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.hex'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.hex'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class ImeiValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless valid?(value.to_s)
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.imei'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.imei'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class IpValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless value =~ /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.ip'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.ip'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class IsbnValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless valid?(value.to_s)
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.isbn'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.isbn'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class IsinValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless valid?(value)
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.isin'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.isin'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class LatitudeValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless value.present? && value >= -90 && value <= 90
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.latitude'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.latitude'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class LongitudeValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless value.present? && value >= -180 && value <= 180
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.longitude'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.longitude'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class MacAddressValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless valid?(value)
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.mac_address'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.mac_address'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class NameValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless value =~ /\A([a-zA-Z'-]+\s+){1,4}[a-zA-Z'-]*\z/i
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.name'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.name'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class PasswordValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless valid?(value, options)
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.password'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.password'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class PhoneValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless value =~ /^[0-9+\(\)#\.\s\/ext-]+$/i
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.phone'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.phone'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class SedolValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless valid?(value)
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.sedol'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.sedol'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class SlugValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless value =~ /^[a-z0-9-]+$/
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.slug'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.slug'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class SsnValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless value =~ /^\A([\d]{3}\-[\d]{2}\-[\d]{4}|[\d]{9})\Z$/
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.ssn'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.ssn'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -5,7 +5,7 @@ class UrlValidator < ActiveModel::EachValidator
|
|
5
5
|
uri = URI.parse(value)
|
6
6
|
raise URI::InvalidURIError unless valid?(uri, options)
|
7
7
|
rescue URI::InvalidURIError
|
8
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.url'))
|
8
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.url'))
|
9
9
|
end
|
10
10
|
|
11
11
|
private
|
@@ -2,7 +2,7 @@ class UsernameValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless value =~ /^[a-z0-9_-]{2,16}$/
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.username'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.username'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -2,7 +2,7 @@ class UuidValidator < ActiveModel::EachValidator
|
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
4
|
unless valid?(value, options)
|
5
|
-
record.errors[attribute] << (options[:message] || I18n.t('errors.messages.uuid'))
|
5
|
+
record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.uuid'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|