From 8637a3015e243cd45c179c1360e781aee7b75347 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Thu, 26 Apr 2018 16:59:16 +0200 Subject: [PATCH] Simplify Procedure#generate_export code --- app/models/procedure.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/procedure.rb b/app/models/procedure.rb index e1a67e0fb..e0cc03d12 100644 --- a/app/models/procedure.rb +++ b/app/models/procedure.rb @@ -189,7 +189,7 @@ class Procedure < ApplicationRecord def generate_export exportable_dossiers = dossiers.downloadable_sorted - headers = exportable_dossiers.any? ? exportable_dossiers.first.export_headers : [] + headers = exportable_dossiers&.first&.export_headers || [] data = exportable_dossiers.any? ? exportable_dossiers.map { |d| d.full_data_strings_array } : [[]] {