Add completions
Some checks are pending
CI / scan_ruby (push) Waiting to run
CI / scan_js (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run

This commit is contained in:
sto
2025-03-20 11:12:55 +01:00
parent 44507bb85c
commit a03907f756
20 changed files with 213 additions and 14 deletions

View File

@@ -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