Module: StringifyDate::ActiveRecord::Stringify

Extended by:
ActiveSupport::Concern
Defined in:
lib/stringify_date/active_record/stringify.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#parse_value(name, value, format) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/stringify_date/active_record/stringify.rb', line 10

def parse_value(name, value, format)
  return nil unless value.present?

  begin
    Time.strptime(value, format)
  rescue ArgumentError
    instance_variable_set("@#{name}_invalid", true)
    nil
  end
end