Implement update

This commit is contained in:
Maximilian Grundke
2017-10-04 11:35:51 +02:00
parent f0c0621b31
commit 7cb7146e7e
3 changed files with 24 additions and 1 deletions

View File

@ -1,6 +1,7 @@
class ExerciseCollectionsController < ApplicationController
include CommonBehavior
before_action :set_exercise_collection, only: [:show]
before_action :set_exercise_collection, only: [:show, :edit, :update]
def index
@exercise_collections = ExerciseCollection.all.paginate(:page => params[:page])
@ -10,6 +11,12 @@ class ExerciseCollectionsController < ApplicationController
def show
end
def edit
end
def update
update_and_respond(object: @exercise_collection, params: exercise_collection_params)
end
private
@ -21,4 +28,8 @@ class ExerciseCollectionsController < ApplicationController
def authorize!
authorize(@exercise_collection || @exercise_collections)
end
def exercise_collection_params
params[:exercise_collection].permit(:name, :exercise_ids)
end
end