Prevent crash in preview where there is no siblings

This commit is contained in:
Paul Chavard 2021-04-06 18:15:29 +01:00
parent f9c9a7c115
commit 5e5122a436
2 changed files with 2 additions and 2 deletions

View file

@ -88,7 +88,7 @@ class Champ < ApplicationRecord
end
def sections
siblings.filter(&:header_section?)
siblings&.filter(&:header_section?)
end
def mandatory_and_blank?

View file

@ -23,7 +23,7 @@ class Champs::HeaderSectionChamp < Champ
end
def libelle_with_section_index
if sections.none?(&:libelle_with_section_index?)
if sections&.none?(&:libelle_with_section_index?)
"#{section_index}. #{libelle}"
else
libelle