diff options
author | Janko Marohnić <janko.marohnic@gmail.com> | 2018-04-23 22:07:50 +0200 |
---|---|---|
committer | Janko Marohnić <janko.marohnic@gmail.com> | 2018-04-23 22:07:50 +0200 |
commit | f2e2cef15bdb31353aee2254ca2ab378979cc24a (patch) | |
tree | 68603258859327f94e40be3cf57a65b5ea39877a | |
parent | 151167eb3d9510bfb0f1408c150b5564b44cb2e6 (diff) | |
download | rails-f2e2cef15bdb31353aee2254ca2ab378979cc24a.tar.gz rails-f2e2cef15bdb31353aee2254ca2ab378979cc24a.tar.bz2 rails-f2e2cef15bdb31353aee2254ca2ab378979cc24a.zip |
Don't swallow LoadError raised for missing libvips
-rw-r--r-- | activestorage/app/models/active_storage/variation.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/activestorage/app/models/active_storage/variation.rb b/activestorage/app/models/active_storage/variation.rb index 7b66541ce6..42f00beb82 100644 --- a/activestorage/app/models/active_storage/variation.rb +++ b/activestorage/app/models/active_storage/variation.rb @@ -105,10 +105,14 @@ class ActiveStorage::Variation # Returns the ImageProcessing processor class specified by `ActiveStorage.variant_processor`. def processor - require "image_processing" + begin + require "image_processing" + rescue LoadError + ActiveSupport::Deprecation.warn("Using mini_magick gem directly is deprecated and will be removed in Rails 6.1. Please add `gem 'image_processing', '~> 1.2'` to your Gemfile.") + return nil + end + ImageProcessing.const_get(ActiveStorage.variant_processor.to_s.camelize) if ActiveStorage.variant_processor - rescue LoadError - ActiveSupport::Deprecation.warn("Using mini_magick gem directly is deprecated and will be removed in Rails 6.1. Please add `gem 'image_processing', '~> 1.2'` to your Gemfile.") end def pass_transform_argument(command, method, argument) |