Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Active storage variants in Rails 6> #3255

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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