demarches-normaliennes/app/controllers/champs/repetition_controller.rb
2019-07-30 18:09:28 +02:00

18 lines
518 B
Ruby

class Champs::RepetitionController < ApplicationController
before_action :authenticate_logged_user!
def show
@champ = policy_scope(Champ).find(params[:champ_id])
@position = params[:position]
row = (@champ.champs.empty? ? 0 : @champ.champs.last.row) + 1
@champ.add_row(row)
if @champ.private?
@attribute = "dossier[champs_private_attributes][#{@position}][champs_attributes]"
else
@attribute = "dossier[champs_attributes][#{@position}][champs_attributes]"
end
end
end