Skip to content

Commit

Permalink
Merge pull request #3255 from kallelundgren93/active_storage_variants…
Browse files Browse the repository at this point in the history
…/image_processing_vs_mm

Active storage variants in Rails 6>
  • Loading branch information
mshibuya committed Feb 28, 2021
2 parents 3d8cb28 + d3ea599 commit b552f2c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/rails_admin/config/fields/types/active_storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ class ActiveStorage < RailsAdmin::Config::Fields::Types::FileUpload
RailsAdmin::Config::Fields::Types.register(self)

register_instance_option :thumb_method do
{resize: '100x100>'}
if Gem.loaded_specs.key?('ruby-vips')
{resize_to_limit: [100, 100]}
else
{resize: '100x100>'}
end
end

register_instance_option :delete_method do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ class MultipleActiveStorage < RailsAdmin::Config::Fields::Types::MultipleFileUpl

class ActiveStorageAttachment < RailsAdmin::Config::Fields::Types::MultipleFileUpload::AbstractAttachment
register_instance_option :thumb_method do
{resize: '100x100>'}
if Gem.loaded_specs.key?('ruby-vips')
{resize_to_limit: [100, 100]}
else
{resize: '100x100>'}
end
end

register_instance_option :delete_value do
Expand Down

0 comments on commit b552f2c

Please sign in to comment.