]> source.dussan.org Git - redmine.git/commitdiff
Workaround for #12750.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 8 Jan 2013 20:02:53 +0000 (20:02 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 8 Jan 2013 20:02:53 +0000 (20:02 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11138 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/core_ext/active_record.rb

index 69bf76adc1473dfcb7eac1df353e19ab6d523440..5eab1cb6c932c99fc53984071bafe1643a908841 100644 (file)
@@ -43,7 +43,8 @@ class DateValidator < ActiveModel::EachValidator
   def validate_each(record, attribute, value)
     before_type_cast = record.attributes_before_type_cast[attribute.to_s]
     if before_type_cast.is_a?(String) && before_type_cast.present?
-      unless before_type_cast =~ /\A\d{4}-\d{2}-\d{2}\z/ && value
+      # TODO: #*_date_before_type_cast returns a Mysql::Time with ruby1.8+mysql gem
+      unless before_type_cast =~ /\A\d{4}-\d{2}-\d{2}( 00:00:00)?\z/ && value
         record.errors.add attribute, :not_a_date
       end
     end