Migration to Ruby 2.5, Rails 5.1.5, Elasticsearch 5.4.3

This commit is contained in:
Joerg Reichert 2018-03-18 21:21:59 +01:00
parent 85d2ad5d57
commit ad77627973
17 changed files with 180 additions and 170 deletions

View file

@ -3,7 +3,7 @@ class ParseableDateValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
raw_value = record.read_attribute_before_type_cast(attribute)
return nil if raw_value.nil?
Date.parse(raw_value)
Date.parse(raw_value.to_json)
nil
rescue ArgumentError => e
record.errors[attribute] << (options[:message] || I18n.t("errors.messages.unparseable_date"))