diff options
author | Eugene Kenny <elkenny@gmail.com> | 2018-02-25 00:54:27 +0000 |
---|---|---|
committer | Eugene Kenny <elkenny@gmail.com> | 2018-02-25 00:54:27 +0000 |
commit | eb834811dc029faa059595e72294d418fb74d0a1 (patch) | |
tree | 3f4afdb6d546825aea1e853cbb08a0cb410700d2 /activestorage/lib/active_storage | |
parent | efd3338b193da5ae5f0d42c4ad792d65e744428c (diff) | |
download | rails-eb834811dc029faa059595e72294d418fb74d0a1.tar.gz rails-eb834811dc029faa059595e72294d418fb74d0a1.tar.bz2 rails-eb834811dc029faa059595e72294d418fb74d0a1.zip |
Use lazy load hook to configure ActiveStorage::Blob
`to_prepare` callbacks are run during initialization; using one here
meant that `ActiveStorage::Blob` would be loaded when the app boots,
which would in turn load `ActiveRecord::Base`.
By using a lazy load hook to configure `ActiveStorage::Blob` instead,
we can avoid loading `ActiveRecord::Base` unnecessarily.
Diffstat (limited to 'activestorage/lib/active_storage')
-rw-r--r-- | activestorage/lib/active_storage/engine.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activestorage/lib/active_storage/engine.rb b/activestorage/lib/active_storage/engine.rb index 9430dde028..1e223f9f17 100644 --- a/activestorage/lib/active_storage/engine.rb +++ b/activestorage/lib/active_storage/engine.rb @@ -68,7 +68,7 @@ module ActiveStorage end initializer "active_storage.services" do - config.to_prepare do + ActiveSupport.on_load(:active_storage_blob) do if config_choice = Rails.configuration.active_storage.service configs = Rails.configuration.active_storage.service_configurations ||= begin config_file = Pathname.new(Rails.root.join("config/storage.yml")) |