Sha256: 2507549d75f146aeee89bd14fdb9f49db0caa4c6ed4d517293d54cea47a63b06

Contents?: true

Size: 471 Bytes

Versions: 1

Compression:

Stored size: 471 Bytes

Contents

# frozen_string_literal: true

module Fields
  class DateField < Field
    serialize :validations, Validations::DateField
    serialize :options, Options::DateField

    def stored_type
      :datetime
    end

    protected

    def interpret_extra_to(model, accessibility, overrides = {})
      super

      model.class_eval <<-CODE, __FILE__, __LINE__ + 1
        def #{name}=(val)
          super(val.try(:in_time_zone)&.utc)
        end
      CODE
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
script_core-0.1.0 spec/dummy/app/models/fields/date_field.rb