diff --git a/back/engines/commercial/multi_tenancy/app/services/multi_tenancy/templates/utils.rb b/back/engines/commercial/multi_tenancy/app/services/multi_tenancy/templates/utils.rb index a471f789ac37..f4805c338432 100644 --- a/back/engines/commercial/multi_tenancy/app/services/multi_tenancy/templates/utils.rb +++ b/back/engines/commercial/multi_tenancy/app/services/multi_tenancy/templates/utils.rb @@ -270,7 +270,7 @@ def parse_yml(content) YAML.load( content, aliases: true, - permitted_classes: [Date, Project, Symbol, Time] + permitted_classes: [Date, Time, Symbol, *ar_classes] ) end alias parse_yaml parse_yml @@ -283,6 +283,13 @@ def parse_yml_file(file) private + def ar_classes + @ar_classes ||= begin + Rails.application.eager_load! # Make sure all model classes are loaded. + ApplicationRecord.descendants + end + end + def template_locales(serialized_models) locales = Set.new