Permalink
Browse files

Fixed bug: now AS::TimeWithZone is totally optional

  • Loading branch information...
1 parent da38e62 commit a2fc5b670abf26102bfe6ed093880bd5c49b4de7 @txus txus committed Jun 8, 2010
Showing with 3 additions and 3 deletions.
  1. +2 −2 date_validator.gemspec
  2. +1 −1 lib/date_validator.rb
View
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = %q{date_validator}
- s.version = "0.4.1"
+ s.version = "0.4.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Oriol Gual", "Josep M\302\252 Bach", "Josep Jaume Rey"]
- s.date = %q{2010-05-14}
+ s.date = %q{2010-06-03}
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 :)}
s.email = %q{info@codegram.com}
s.extra_rdoc_files = [
View
@@ -29,7 +29,7 @@ def validate_each(record, attr_name, value)
option_value = option_value.call(record) if option_value.is_a?(Proc)
option_value = record.send(option_value) if option_value.is_a?(Symbol)
- option_value = option_value.to_datetime if option_value.is_a? ActiveSupport::TimeWithZone
+ option_value = option_value.to_datetime if (defined?(ActiveSupport::TimeWithZone) and option_value.is_a? ActiveSupport::TimeWithZone)
unless is_time?(option_value) && value.send(CHECKS[option], option_value)
record.errors.add(attr_name, option, :default => options[:message], :value => value, :date => option_value)

0 comments on commit a2fc5b6

Please sign in to comment.