clarion/app/controllers/public/events_controller.rb
2015-08-15 03:43:41 +03:00

37 lines
846 B
Ruby

module Public
class EventsController < Public::ApplicationController
before_filter :authenticate_user!
def index
end
def new
event_type = current_conference.event_types.find(params[:type])
@event = Event.new event_type: event_type
end
def create
@event = Event.new event_params
@event.conference = current_conference
@event.build_proposition proposer: current_user
@event.participations.build participant: current_user, approved: true
if @event.save
redirect_to action: :index
else
render action: :new
end
end
private
def event_params
params.require(:event).permit(
:title, :subtitle, :track_id, :length, :language,
:abstract, :description, :notes, :agreement,
:event_type_id
)
end
end
end