Module: Spree::ActiveStorageAdapter

Extended by:
ActiveSupport::Concern
Includes:
Normalization
Included in:
Image::ActiveStorageAttachment, Taxon::ActiveStorageAttachment
Defined in:
core/app/models/concerns/spree/active_storage_adapter.rb,
core/app/models/concerns/spree/active_storage_adapter/attachment.rb,
core/app/models/concerns/spree/active_storage_adapter/normalization.rb

Overview

Adapts ActiveStorage interface to make it compliant with Solidus' Paperclip-oriented attachment support.

Defined Under Namespace

Modules: Normalization Classes: Attachment

Instance Method Summary collapse

Methods included from Normalization

#normalize_attachable

Instance Method Details

#default_styleObject



100
101
102
# File 'core/app/models/concerns/spree/active_storage_adapter.rb', line 100

def default_style
  self.class.attachment_definition[:default_style]
end

#destroy_attachment(_name) ⇒ Object



112
113
114
# File 'core/app/models/concerns/spree/active_storage_adapter.rb', line 112

def destroy_attachment(_name)
  attachment.destroy
end

#filenameObject



104
105
106
# File 'core/app/models/concerns/spree/active_storage_adapter.rb', line 104

def filename
  attachment.filename
end

#stylesObject



96
97
98
# File 'core/app/models/concerns/spree/active_storage_adapter.rb', line 96

def styles
  self.class.attachment_definition[:styles]
end

#url(style = default_style) ⇒ Object



108
109
110
# File 'core/app/models/concerns/spree/active_storage_adapter.rb', line 108

def url(style = default_style)
  attachment.url(style)
end