Give access to the events to all participants

This commit is contained in:
Petko Bordjukov 2016-10-16 15:28:29 +03:00
parent 0284c8ec7e
commit f45cb7e9c4
1 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,7 @@ module Public
end
def edit
@event = current_user.events.find(params[:id])
@event = Event.joins(:participations).find_by(id: params[:id], participations: {participant_id: current_user.id})
end
def new
@ -30,7 +30,7 @@ module Public
end
def update
@event = current_user.events.find(params[:id])
@event = Event.joins(:participations).find_by(id: params[:id], participations: {participant_id: current_user.id})
if @event.update(event_params)
flash[:notice] = I18n.t('views.events.event_successfully_updated', event_type: @event.event_type.name.mb_chars.downcase)