Skip to content

Commit

Permalink
Also eager_load additional modules
Browse files Browse the repository at this point in the history
This is to ensure that `Rails.application.eager_load!` in the rails_erd
gem respects all our modules.

See this line:
https://github.com/voormedia/rails-erd/blob/7c66258b6818c47b4d878c2ad7ff6decebdf834a/lib/rails_erd/tasks.rake#L45
  • Loading branch information
Splines committed Oct 15, 2024
1 parent 57fa450 commit 4ed73bc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ class Application < Rails::Application

# Autoload subfolders of modules (recursively)
# https://stackoverflow.com/a/4794775/
config.autoload_paths += Rails.root.glob("app/models/**/")
additional_paths = Rails.root.glob("app/models/**/")
config.autoload_paths += additional_paths
config.eager_load_paths += additional_paths

# Autoload lib extensions path
config.autoload_lib(ignore: ["assets", "collectors", "core_ext", "scrapers", "tasks"])
Expand All @@ -29,7 +31,6 @@ class Application < Rails::Application
# See: https://guides.rubyonrails.org/v7.1/configuring.html#config-active-support-message-serializer
Rails.application.config.active_support.message_serializer = :json

# config.eager_load_paths << Rails.root.join("extras")
# Make `form_with` generate remote forms by default.
config.action_view.form_with_generates_remote_forms = true
# Settings in config/environments/* take precedence over those specified here.
Expand Down

0 comments on commit 4ed73bc

Please sign in to comment.