Module: Alchemy::StorageAdapter::ActiveStorage::PictureClassMethods

Defined in:
app/models/alchemy/storage_adapter/active_storage.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
12
# File 'app/models/alchemy/storage_adapter/active_storage.rb', line 5

def self.included(base)
  base.has_one_attached :image_file do |attachable|
    # Only works in Rails 7.1+
    # https://github.com/rails/rails/pull/47473
    Alchemy.storage_adapter.preprocessor_class.new(attachable).call
    Alchemy.storage_adapter.preprocessor_class.generate_thumbs!(attachable)
  end
end