date_validator 0.5.3 → 0.5.4

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.3
1
+ 0.5.4
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{date_validator}
8
- s.version = "0.5.3"
8
+ s.version = "0.5.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Oriol Gual", "Josep M\302\252 Bach", "Josep Jaume Rey"]
@@ -30,7 +30,10 @@ module ActiveModel
30
30
  options.slice(*CHECKS.keys).each do |option, option_value|
31
31
  option_value = option_value.call(record) if option_value.is_a?(Proc)
32
32
  option_value = record.send(option_value) if option_value.is_a?(Symbol)
33
-
33
+
34
+ original_value = value
35
+ original_option_value = option_value
36
+
34
37
  # To enable to_i conversion, these types must be converted to Datetimes
35
38
  if defined?(ActiveSupport::TimeWithZone)
36
39
  option_value = option_value.to_datetime if option_value.is_a?(ActiveSupport::TimeWithZone)
@@ -41,9 +44,10 @@ module ActiveModel
41
44
  option_value = option_value.to_datetime if option_value.is_a?(Date)
42
45
  value = value.to_datetime if value.is_a?(Date)
43
46
  end
47
+
44
48
 
45
49
  unless is_time?(option_value) && value.to_i.send(CHECKS[option], option_value.to_i)
46
- record.errors.add(attr_name, option, :default => options[:message], :value => value, :date => option_value)
50
+ record.errors.add(attr_name, option, :default => options[:message], :value => original_value, :date => original_option_value)
47
51
  end
48
52
  end
49
53
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: date_validator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 3
10
- version: 0.5.3
9
+ - 4
10
+ version: 0.5.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Oriol Gual