From 9fc6c3b641f06507b53fec62f9477ea250b00190 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Wed, 15 Nov 2023 10:33:48 +0100 Subject: [PATCH] attestation_template v2 : add feature flag --- .../administrateurs/attestation_template_v2s_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/administrateurs/attestation_template_v2s_controller.rb b/app/controllers/administrateurs/attestation_template_v2s_controller.rb index 1902221b6..685ddde17 100644 --- a/app/controllers/administrateurs/attestation_template_v2s_controller.rb +++ b/app/controllers/administrateurs/attestation_template_v2s_controller.rb @@ -1,6 +1,6 @@ module Administrateurs class AttestationTemplateV2sController < AdministrateurController - before_action :retrieve_procedure, :retrieve_attestation_template + before_action :retrieve_procedure, :retrieve_attestation_template, :ensure_feature_active def show json_body = @attestation_template.json_body&.deep_symbolize_keys @@ -33,6 +33,10 @@ module Administrateurs private + def ensure_feature_active + redirect_to root_path if !@procedure.feature_enabled?(:attestation_v2) + end + def retrieve_attestation_template @attestation_template = @procedure.attestation_template || @procedure.build_attestation_template end