app/models/tramway/event/participant_form_field.rb in tramway-event-1.11.1 vs app/models/tramway/event/participant_form_field.rb in tramway-event-1.11.2
- old
+ new
@@ -1,13 +1,17 @@
# 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], default: :text
+ 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