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: d7126e211ff8cc2c76bbc143034a89b09a7653c2
4
- data.tar.gz: f5d95f4377b7dee952721d82411103f858ea99b2
3
+ metadata.gz: 3b3c37a0ea5dafc85f13adb8ef2aedf5e7aa9056
4
+ data.tar.gz: 872e9ca16eb9787e673deb3df8f4ae4e467d5c17
5
5
  SHA512:
6
- metadata.gz: 4a0f805b197124c5829b0d3b6fb701c51127206f8cf4f66d549bfeaff6c8ae949f05af7f44e078831c6aacf06ea33d38d16b4dd382f0a92fe7e0049baeddf2ed
7
- data.tar.gz: 5caa9fbc1a50087bcf36408176ed9d05c0d366d408be451704be84cf15ff12121a9d56c7af4e3d969378fbca6a6da8d56da119397147177bb0cc1a1da99c7dde
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 [true, false, 1, 0].include?(value)
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
@@ -1,3 +1,3 @@
1
1
  module ActiveValidation
2
- VERSION = "2.2.1"
2
+ VERSION = "2.2.2"
3
3
  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.1
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-08-31 00:00:00.000000000 Z
11
+ date: 2015-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel