active_validation 2.2.1 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b3c37a0ea5dafc85f13adb8ef2aedf5e7aa9056
|
4
|
+
data.tar.gz: 872e9ca16eb9787e673deb3df8f4ae4e467d5c17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b58170b66edd9b572ec7a79b1af3eabb303f5daa93f778b3ff07e274f3269fabbd51e18dacebf4d90c23bbff50e025beedbbb7d44a8262853802d4e159c1516
|
7
|
+
data.tar.gz: cd2b3b55ffe6993f903d0becf597852c4843d03501281d88a205f800088d5fad8b88b79d307473ce2f5f08f2602d420b89ed173fe312b64cf699f90c59569498
|
@@ -1,9 +1,14 @@
|
|
1
1
|
class BooleanValidator < ActiveModel::EachValidator
|
2
2
|
|
3
3
|
def validate_each(record, attribute, value)
|
4
|
-
unless
|
4
|
+
unless TRUE_VALUES.include?(value) || FALSE_VALUES.include?(value)
|
5
5
|
record.errors[attribute] << (options[:message] || I18n.t('active_validation.errors.messages.boolean'))
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
9
|
+
private
|
10
|
+
|
11
|
+
FALSE_VALUES = [false, 0, '0', 'f', 'F', 'false', 'FALSE']
|
12
|
+
TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE']
|
13
|
+
|
9
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_validation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|