Give access to the events to all participants
This commit is contained in:
parent
0284c8ec7e
commit
f45cb7e9c4
|
@ -7,7 +7,7 @@ module Public
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
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
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
@ -30,7 +30,7 @@ module Public
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
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)
|
if @event.update(event_params)
|
||||||
flash[:notice] = I18n.t('views.events.event_successfully_updated', event_type: @event.event_type.name.mb_chars.downcase)
|
flash[:notice] = I18n.t('views.events.event_successfully_updated', event_type: @event.event_type.name.mb_chars.downcase)
|
||||||
|
|
Loading…
Reference in New Issue