cache columns per request using Current

This commit is contained in:
simon lehericey 2024-09-25 12:43:23 +02:00
parent 249ddf291f
commit 450420aa81
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
2 changed files with 10 additions and 5 deletions

View file

@ -10,11 +10,15 @@ module ColumnsConcern
end
def columns
columns = dossier_columns
columns.concat(standard_columns)
columns.concat(individual_columns) if for_individual
columns.concat(moral_columns) if !for_individual
columns.concat(types_de_champ_columns)
Current.procedure_columns ||= {}
Current.procedure_columns[id] ||= begin
columns = dossier_columns
columns.concat(standard_columns)
columns.concat(individual_columns) if for_individual
columns.concat(moral_columns) if !for_individual
columns.concat(types_de_champ_columns)
end
end
def dossier_id_column

View file

@ -9,4 +9,5 @@ class Current < ActiveSupport::CurrentAttributes
attribute :no_reply_email
attribute :request_id
attribute :user
attribute :procedure_columns
end