active_validation 4.0.3 → 4.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/locales/en.yml +23 -23
- data/lib/active_validation.rb +1 -25
- data/lib/active_validation/railtie.rb +23 -0
- data/lib/active_validation/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fa33ee5eaf935e3e4ad2534df237304c5645bb7
|
4
|
+
data.tar.gz: 5e7832cfa49cc05eb16efd14203e868bef8edac6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 932cecc243591dfcf9e06812777db97804de73b749f4f8b8a1b7cd33a014fb4347add0004a4969c0eb82971c3949185b8a2a0efe59a589e37b9f25072dd5c88f
|
7
|
+
data.tar.gz: cd8e2c138de7b7c570b5df5a892ae89182fa76df860d9fc41b7edaae09ad4b1ad0b9a4fa02008ce37bfd47be52b0121a6076513cd6fe07325e024c344a2fbc3d
|
data/config/locales/en.yml
CHANGED
@@ -2,36 +2,36 @@ en:
|
|
2
2
|
active_validation:
|
3
3
|
errors:
|
4
4
|
messages:
|
5
|
-
alpha: 'is not
|
6
|
-
alpha_numeric: 'is not
|
7
|
-
base64: 'is not
|
5
|
+
alpha: 'is not in valid alpha format'
|
6
|
+
alpha_numeric: 'is not in valid alpha-numeric format'
|
7
|
+
base64: 'is not in valid Base64 encode format'
|
8
8
|
boolean: 'is not a valid boolean'
|
9
9
|
coordinate:
|
10
10
|
coordinate: 'is not a valid coordinate'
|
11
11
|
latitude: 'is not a valid latitude'
|
12
12
|
longitude: 'is not a valid longitude'
|
13
|
-
credit_card: 'is not a valid credit card'
|
14
|
-
currency: 'is not
|
15
|
-
cusip: 'is not
|
16
|
-
email: 'is not
|
13
|
+
credit_card: 'is not a valid credit card format'
|
14
|
+
currency: 'is not in valid currency format'
|
15
|
+
cusip: 'is not in valid CUSIP format'
|
16
|
+
email: 'is not in valid email format'
|
17
17
|
equality: 'is not %{operator} %{attr}'
|
18
|
-
hex: 'is not
|
19
|
-
imei: 'is not
|
20
|
-
ip: 'is not
|
21
|
-
isbn: 'is not
|
22
|
-
isin: 'is not
|
23
|
-
mac_address: 'is not
|
24
|
-
name: 'is not
|
25
|
-
password: 'is not
|
26
|
-
phone: 'is not
|
27
|
-
sedol: 'is not
|
28
|
-
slug: 'is not
|
29
|
-
ssn: 'is not
|
30
|
-
tracking_number: 'is not
|
18
|
+
hex: 'is not in valid hex color format'
|
19
|
+
imei: 'is not in valid IMEI format'
|
20
|
+
ip: 'is not in valid IP format'
|
21
|
+
isbn: 'is not in valid ISBN format'
|
22
|
+
isin: 'is not in valid ISIN format'
|
23
|
+
mac_address: 'is not in valid MAC address format'
|
24
|
+
name: 'is not in valid name format'
|
25
|
+
password: 'is not in valid password format'
|
26
|
+
phone: 'is not in valid phone number format'
|
27
|
+
sedol: 'is not in valid SEDOL format'
|
28
|
+
slug: 'is not in valid slug format'
|
29
|
+
ssn: 'is not in valid social security number format'
|
30
|
+
tracking_number: 'is not in valid tracking number format'
|
31
31
|
type: 'is not a valid type'
|
32
|
-
url: 'is not
|
33
|
-
username: 'is not
|
34
|
-
uuid: 'is not
|
32
|
+
url: 'is not in valid URL format'
|
33
|
+
username: 'is not in valid username format'
|
34
|
+
uuid: 'is not in valid UUID format'
|
35
35
|
matchers:
|
36
36
|
ensure_valid_alpha_format_of:
|
37
37
|
failure_message_for_should: '%{model} should ensure valid alpha format of attribute %{attr}'
|
data/lib/active_validation.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'active_model'
|
2
2
|
require 'active_support'
|
3
3
|
|
4
|
-
%w(version)
|
4
|
+
%w(version railtie)
|
5
5
|
.each do |file_name|
|
6
6
|
require "active_validation/#{file_name}"
|
7
7
|
end
|
@@ -14,27 +14,3 @@ ACTIVE_VALIDATION_VALIDATORS ||= %w(
|
|
14
14
|
ACTIVE_VALIDATION_VALIDATORS.each do |file_name|
|
15
15
|
require "active_validation/validators/#{file_name}_validator"
|
16
16
|
end
|
17
|
-
|
18
|
-
if defined?(Rails)
|
19
|
-
require 'rails'
|
20
|
-
|
21
|
-
module ActiveValidation
|
22
|
-
class Railtie < ::Rails::Railtie
|
23
|
-
|
24
|
-
initializer 'active_validation' do |app|
|
25
|
-
ActiveValidation::Railtie.instance_eval do
|
26
|
-
[app.config.i18n.available_locales].flatten.each do |locale|
|
27
|
-
(I18n.load_path << path(locale)) if File.file?(path(locale))
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
protected
|
33
|
-
|
34
|
-
def self.path(locale)
|
35
|
-
File.expand_path("../../config/locales/#{locale}.yml", __FILE__)
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
if defined?(Rails)
|
2
|
+
require 'rails'
|
3
|
+
|
4
|
+
module ActiveValidation
|
5
|
+
class Railtie < ::Rails::Railtie
|
6
|
+
|
7
|
+
initializer 'active_validation' do |app|
|
8
|
+
ActiveValidation::Railtie.instance_eval do
|
9
|
+
[app.config.i18n.available_locales].flatten.each do |locale|
|
10
|
+
(I18n.load_path << path(locale)) if File.file?(path(locale))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.path(locale)
|
16
|
+
File.expand_path("../../config/locales/#{locale}.yml", __FILE__)
|
17
|
+
end
|
18
|
+
|
19
|
+
private_class_method :path
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_validation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
@@ -178,6 +178,7 @@ files:
|
|
178
178
|
- lib/.DS_Store
|
179
179
|
- lib/active_validation.rb
|
180
180
|
- lib/active_validation/.DS_Store
|
181
|
+
- lib/active_validation/railtie.rb
|
181
182
|
- lib/active_validation/validators/alpha_numeric_validator.rb
|
182
183
|
- lib/active_validation/validators/alpha_validator.rb
|
183
184
|
- lib/active_validation/validators/base64_validator.rb
|