Sha256: 509ed1746aa635ac4b98b78d4a4e20cb9b7b143e9cbdedf46e3fd24e55b2c7fa

Contents?: true

Size: 505 Bytes

Versions: 25

Compression:

Stored size: 505 Bytes

Contents

# frozen_string_literal: true

class Tramway::Event::ParticipantFormField < ::Tramway::Event::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, -> { active.order(position: :asc) }

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

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

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
tramway-event-1.11.5 app/models/tramway/event/participant_form_field.rb
tramway-event-1.11.4.1 app/models/tramway/event/participant_form_field.rb
tramway-event-1.11.4 app/models/tramway/event/participant_form_field.rb
tramway-event-1.11.2.1 app/models/tramway/event/participant_form_field.rb
tramway-event-1.11.2 app/models/tramway/event/participant_form_field.rb