From 7d02f0933d421bbc9fd3fdb40a49e21a411323c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sun, 17 Mar 2024 21:30:22 +0100 Subject: [PATCH] Simplify code to autoload paths This we'll simplify adding these same paths to `eager_load_paths` when switching to Zeitwerk. --- config/application.rb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/config/application.rb b/config/application.rb index 6b6d6c51d..d8e243a51 100644 --- a/config/application.rb +++ b/config/application.rb @@ -132,12 +132,17 @@ module Consul # * English: https://github.com/consuldemocracy/consuldemocracy/blob/master/CUSTOMIZE_EN.md # * Spanish: https://github.com/consuldemocracy/consuldemocracy/blob/master/CUSTOMIZE_ES.md # - config.autoload_paths << "#{Rails.root}/app/components/custom" - config.autoload_paths << "#{Rails.root}/app/controllers/custom" - config.autoload_paths << "#{Rails.root}/app/graphql/custom" - config.autoload_paths << "#{Rails.root}/app/mailers/custom" - config.autoload_paths << "#{Rails.root}/app/models/custom" - config.autoload_paths << "#{Rails.root}/app/models/custom/concerns" + + [ + "app/components/custom", + "app/controllers/custom", + "app/graphql/custom", + "app/mailers/custom", + "app/models/custom", + "app/models/custom/concerns" + ].each do |path| + config.autoload_paths << Rails.root.join(path) + end config.paths["app/views"].unshift(Rails.root.join("app", "views", "custom"))