Sha256: 01d5934975b03692d93d2c9a3606e6f4c3bfe6ec39967f57702d252dd3db0aaf

Contents?: true

Size: 491 Bytes

Versions: 3

Compression:

Stored size: 491 Bytes

Contents

# frozen_string_literal: true

class Tramway::Event::ParticipantFormField < ::Tramway::ApplicationRecord
  belongs_to :event, class_name: 'Tramway::Event::Event'

  enumerize :field_type, in: %i[text string numeric date_picker select checkbox], default: :text

  scope :inputs_list, -> { order(position: :asc) }

  def required
    options.present? && options.dig('validations', 'presence') == 'true'
  end

  def validations
    (options == '' ? {} : options)&.dig('validations')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tramway-event-2.0.1 app/models/tramway/event/participant_form_field.rb
tramway-event-2.0.0.1 app/models/tramway/event/participant_form_field.rb
tramway-event-2.0 app/models/tramway/event/participant_form_field.rb