Set active conference upon creation

This commit is contained in:
Andrew Radev 2015-05-30 17:18:28 +03:00
parent 906e95f2e3
commit c2c108ca07
1 changed files with 8 additions and 16 deletions

View File

@ -10,9 +10,10 @@ module Management
end end
def create def create
@conference = Conference.new conference_params @conference = Conference.new(conference_params)
if @conference.save if @conference.save
set_current_conference(@conference)
redirect_to [:management, @conference] redirect_to [:management, @conference]
else else
render :new render :new
@ -20,7 +21,7 @@ module Management
end end
def update def update
@conference.update conference_params @conference.update(conference_params)
@conference.save @conference.save
render :edit render :edit
end end
@ -65,20 +66,11 @@ module Management
end end
def conference_params def conference_params
params.require(:conference).permit [:title, params.require(:conference).permit(
:email, :title, :email, :start_date, :end_date, :description,
:start_date, tracks_attributes: [:id, :name, :color, :description, :_destroy],
:end_date, halls_attributes: [:id, :name, :_destroy]
:description, )
tracks_attributes: [:id,
:name,
:color,
:description,
:_destroy],
halls_attributes: [:id,
:name,
:_destroy]
]
end end
end end
end end