date_validator 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{date_validator}
8
- s.version = "0.4.1"
8
+ s.version = "0.4.2"
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"]
12
- s.date = %q{2010-05-14}
12
+ s.date = %q{2010-06-03}
13
13
  s.description = %q{A simple date validator for Rails 3. Currently supporting :after, :before, :after_or_equal_to and :before_or_equal_to options. Remarkable-friendly :)}
14
14
  s.email = %q{info@codegram.com}
15
15
  s.extra_rdoc_files = [
@@ -28,7 +28,9 @@ module ActiveModel
28
28
  options.slice(*CHECKS.keys).each do |option, option_value|
29
29
  option_value = option_value.call(record) if option_value.is_a?(Proc)
30
30
  option_value = record.send(option_value) if option_value.is_a?(Symbol)
31
-
31
+
32
+ option_value = option_value.to_datetime if option_value.is_a? ActiveSupport::TimeWithZone
33
+
32
34
  unless is_time?(option_value) && value.send(CHECKS[option], option_value)
33
35
  record.errors.add(attr_name, option, :default => options[:message], :value => value, :date => option_value)
34
36
  end
@@ -36,7 +38,7 @@ module ActiveModel
36
38
  end
37
39
 
38
40
  def is_time?(object)
39
- object.is_a?(Time) || (defined?(Date) and object.is_a?(Date))
41
+ object.is_a?(Time) || (defined?(Date) and object.is_a?(Date)) || (defined?(ActiveSupport::TimeWithZone) and object.is_a?(ActiveSupport::TimeWithZone))
40
42
  end
41
43
 
42
44
  module ClassMethods
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 1
9
- version: 0.4.1
8
+ - 2
9
+ version: 0.4.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Oriol Gual
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-05-14 00:00:00 +02:00
19
+ date: 2010-06-03 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency