Sha256: 6ee634429591ce06ab709400a04b18445eb66fc35e78428d9e30411787e1520e
Contents?: true
Size: 934 Bytes
Versions: 2
Compression:
Stored size: 934 Bytes
Contents
# frozen_string_literal: true module ActiveFields module Field class DateArray < ActiveFields.config.field_base_class acts_as_active_field( array: true, validator: { class_name: "ActiveFields::Validators::DateArrayValidator", options: -> { { min: min, max: max, min_size: min_size, max_size: max_size } }, }, caster: { class_name: "ActiveFields::Casters::DateArrayCaster", }, ) store_accessor :options, :min, :max validates :max, comparison: { greater_than_or_equal_to: :min }, allow_nil: true, if: :min %i[min max].each do |column| define_method(column) do Casters::DateCaster.new.deserialize(super()) end define_method(:"#{column}=") do |other| super(Casters::DateCaster.new.serialize(other)) end end private def set_defaults; end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_fields-1.1.0 | app/models/active_fields/field/date_array.rb |
active_fields-1.0.0 | app/models/active_fields/field/date_array.rb |