Sha256: 1ef15c30ba3c27705bb0479f310ba6a2f3e3e8e6fca26c2da33704645f7549f3
Contents?: true
Size: 481 Bytes
Versions: 2
Compression:
Stored size: 481 Bytes
Contents
# frozen_string_literal: true module ActiveFields module Casters class DateCaster < BaseCaster def serialize(value) casted_value = caster.serialize(value) casted_value.iso8601 if casted_value.is_a?(Date) end def deserialize(value) casted_value = caster.deserialize(value) casted_value if casted_value.is_a?(Date) end private def caster ActiveRecord::Type::Date.new end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_fields-1.1.0 | lib/active_fields/casters/date_caster.rb |
active_fields-1.0.0 | lib/active_fields/casters/date_caster.rb |