fix ignore_usec for with_date and with_time options

This commit is contained in:
Adam Meehan
2009-09-11 13:16:03 +10:00
parent 0e382e15f2
commit df3283e5a1
2 changed files with 22 additions and 9 deletions

View File

@@ -62,13 +62,15 @@ module ValidatesTimeliness
end
def validate_restrictions(record, attr_name, value)
value = if configuration[:with_time] || configuration[:with_date]
restriction_type = type
if configuration[:with_time] || configuration[:with_date]
restriction_type = :datetime
combine_date_and_time(value, record)
else
restriction_type = type
self.class.type_cast_value(value, type, configuration[:ignore_usec])
value = combine_date_and_time(value, record)
end
value = self.class.type_cast_value(value, restriction_type, configuration[:ignore_usec])
return if value.nil?
RESTRICTION_METHODS.each do |option, method|