Class: Tramway::Event::ParticipantsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/tramway/event/participants_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



4
5
6
7
8
9
10
11
12
# File 'app/controllers/tramway/event/participants_controller.rb', line 4

def create
  event = ::Tramway::Event::Event.find params[:tramway_event_participant][:event_id]
  @participant_form = ::Tramway::Event::ParticipantExtendedFormCreator.create_form_class(request.uuid, event).new ::Tramway::Event::Participant.new event_id: event.id
  if @participant_form.submit params[:tramway_event_participant].except :event_id
    redirect_to event_path event, flash: :success
  else
    redirect_to event_path event, flash: :error, errors: @participant_form.errors.messages, participant: @participant_form.attributes
  end
end