Fail fast if passed champ_id is invalid

This commit is contained in:
Paul Chavard 2018-11-21 12:41:50 +01:00
parent b596956761
commit 49c872fb97

View file

@ -14,7 +14,7 @@ class Champs::CarteController < ApplicationController
@champ = Champ
.joins(:dossier)
.where(dossiers: { user_id: logged_user_ids })
.find_by(id: params[:champ_id])
.find(params[:champ_id])
else
@champ = Champs::CarteChamp.new(type_de_champ: TypeDeChamp.new(
type_champ: TypeDeChamp.type_champs.fetch(:carte),