Add completions
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
class ContestantsController < ApplicationController
|
||||
before_action :set_contest
|
||||
before_action :set_contestant, only: %i[ destroy edit update]
|
||||
before_action :set_completions, only: %i[edit update ]
|
||||
|
||||
def edit
|
||||
@title = "Edit contestant"
|
||||
@@ -26,6 +27,7 @@ class ContestantsController < ApplicationController
|
||||
if @contestant.update(contestant_params)
|
||||
redirect_to @contest
|
||||
else
|
||||
@title = "Edit contestant"
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
@@ -45,6 +47,10 @@ class ContestantsController < ApplicationController
|
||||
@contestant = Contestant.find(params[:id])
|
||||
end
|
||||
|
||||
def set_completions
|
||||
@completions = @contestant.completions
|
||||
end
|
||||
|
||||
def contestant_params
|
||||
params.expect(contestant: [ :email, :name ])
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user