Sha256: 6c3e395ce0915934ab7724ceeb1a10c83bfeae30f05f2e57862538c57e5d4c34
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true module ActiveFields module Field class TextArray < ActiveFields.config.field_base_class store_accessor :options, :min_size, :max_size, :min_length, :max_length # attribute :min_size, :integer # attribute :max_size, :integer # attribute :min_length, :integer # attribute :max_length, :integer validates :min_size, comparison: { greater_than_or_equal_to: 0 }, allow_nil: true validates :max_size, comparison: { greater_than_or_equal_to: ->(r) { r.min_size || 0 } }, allow_nil: true validates :min_length, comparison: { greater_than_or_equal_to: 0 }, allow_nil: true validates :max_length, comparison: { greater_than_or_equal_to: ->(r) { r.min_length || 0 } }, allow_nil: true %i[min_size max_size min_length max_length].each do |column| define_method(column) do Casters::IntegerCaster.new.deserialize(super()) end define_method(:"#{column}=") do |other| super(Casters::IntegerCaster.new.serialize(other)) end end private def set_defaults; end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_fields-0.2.0 | app/models/active_fields/field/text_array.rb |