From eb834811dc029faa059595e72294d418fb74d0a1 Mon Sep 17 00:00:00 2001 From: Eugene Kenny Date: Sun, 25 Feb 2018 00:54:27 +0000 Subject: 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. --- activestorage/lib/active_storage/engine.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activestorage/lib/active_storage') 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")) -- cgit v1.2.3