Skip to content

Commit

Permalink
Do not reload ApplicationRecord
Browse files Browse the repository at this point in the history
  • Loading branch information
Exterm1nate committed Feb 21, 2025
1 parent 2564807 commit 7184c44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
File renamed without changes.
10 changes: 6 additions & 4 deletions spec/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ class Application < Rails::Application
config.autoload_lib(ignore: %w(assets tasks))

# Disable custom models reloading to avoid STI issues.
# ApplicationRecord is in the class hierarchy, so it should not be reloadable too.
custom_models_dir = "#{root}/app/models/active_fields"
Rails.autoloaders.main.ignore(custom_models_dir)
Rails.autoloaders.once.collapse(custom_models_dir)
config.autoload_once_paths << custom_models_dir
config.eager_load_paths << custom_models_dir
models_core_dir = "#{root}/app/models/core"
Rails.autoloaders.main.ignore(custom_models_dir, models_core_dir)
Rails.autoloaders.once.collapse(custom_models_dir, models_core_dir)
config.autoload_once_paths += [custom_models_dir, models_core_dir]
config.eager_load_paths += [custom_models_dir, models_core_dir]

# Force UTC time zone
config.time_zone = "UTC"
Expand Down

0 comments on commit 7184c44

Please sign in to comment.