Sha256: 03e562f26603e7fa9d19559ad1e73debaf4949291841ee6a0b2b3abddd5ae42b

Contents?: true

Size: 585 Bytes

Versions: 4

Compression:

Stored size: 585 Bytes

Contents

# frozen_string_literal: true

require 'securerandom'

class Tramway::Event::ParticipantForm < ::Tramway::Core::ApplicationForm
  properties :participation_state_event, :comment
  association :event

  def self.new(object)
    if object.event_id.present?
      ::Tramway::Event::ParticipantExtendedFormCreator.create_form_class(
        SecureRandom.hex,
        object.event,
        participation_state_event: :default,
        comment: :string,
      ).new object
    else
      super(object).tap do |obj|
        obj.form_properties event: :association
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tramway-event-1.9.28.1 app/forms/tramway/event/participant_form.rb
tramway-event-1.9.28 app/forms/tramway/event/participant_form.rb
tramway-event-1.9.27.6 app/forms/tramway/event/participant_form.rb
tramway-event-1.9.27.5 app/forms/tramway/event/participant_form.rb