You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
909 B
43 lines
909 B
5 years ago
|
class Cooperative::CompetitionPrizesController < Cooperative::BaseController
|
||
|
def index
|
||
|
@competition = current_competition
|
||
|
end
|
||
|
|
||
|
def new
|
||
|
@prize = current_competition.competition_prizes.new
|
||
|
end
|
||
|
|
||
|
def create
|
||
|
@prize = current_competition.competition_prizes.create!(save_params)
|
||
|
render_ok
|
||
|
end
|
||
|
|
||
|
def edit
|
||
|
@prize = current_competition_prize
|
||
|
end
|
||
|
|
||
|
def update
|
||
|
current_competition_prize.update!(save_params)
|
||
|
render_ok
|
||
|
end
|
||
|
|
||
|
def destroy
|
||
|
current_competition_prize.destroy!
|
||
|
|
||
|
render_delete_success
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
def current_competition_prize
|
||
|
@_current_competition_prize ||= current_competition.competition_prizes.find(params[:id])
|
||
|
end
|
||
|
|
||
|
def current_competition
|
||
|
@_current_competition ||= current_laboratory.competitions.find(params[:competition_id])
|
||
|
end
|
||
|
|
||
|
def save_params
|
||
|
params.require(:competition_prize).permit(:name, :category, :num)
|
||
|
end
|
||
|
end
|