From 3082786be616173f28488e89b7d8b9bfc5cd0f97 Mon Sep 17 00:00:00 2001 From: Joel Taylor Date: Mon, 6 Aug 2018 18:17:49 -0700 Subject: Improve ActiveStorage service adapter error handling --- activestorage/lib/active_storage/service/configurator.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'activestorage/lib') diff --git a/activestorage/lib/active_storage/service/configurator.rb b/activestorage/lib/active_storage/service/configurator.rb index 39951fd026..32fa9105c6 100644 --- a/activestorage/lib/active_storage/service/configurator.rb +++ b/activestorage/lib/active_storage/service/configurator.rb @@ -26,7 +26,9 @@ module ActiveStorage def resolve(class_name) require "active_storage/service/#{class_name.to_s.underscore}_service" - ActiveStorage::Service.const_get(:"#{class_name}Service") + ActiveStorage::Service.const_get(:"#{class_name.classify}Service") + rescue LoadError + raise "Missing service adapter for #{class_name.inspect}" end end end -- cgit v1.2.3