mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2025-04-20 07:11:33 +02:00
Migration to Ruby 2.5, Rails 5.1.5, Elasticsearch 5.4.3
This commit is contained in:
parent
85d2ad5d57
commit
ad77627973
17 changed files with 180 additions and 170 deletions
|
@ -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"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue