Module: Spree::ActiveStorageAdapter
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
#normalize_attachable
Instance Method Details
#default_style ⇒ Object
100
101
102
|
# File 'app/models/concerns/spree/active_storage_adapter.rb', line 100
def default_style
self.class.attachment_definition[:default_style]
end
|
#destroy_attachment(_name) ⇒ Object
114
115
116
|
# File 'app/models/concerns/spree/active_storage_adapter.rb', line 114
def destroy_attachment(_name)
attachment.destroy
end
|
#filename ⇒ Object
104
105
106
|
# File 'app/models/concerns/spree/active_storage_adapter.rb', line 104
def filename
attachment.filename
end
|
#styles ⇒ Object
96
97
98
|
# File '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
111
112
|
# File 'app/models/concerns/spree/active_storage_adapter.rb', line 108
def url(style = default_style)
attachment.url(style)
rescue ActiveStorage::FileNotFoundError
"noimage/#{style}.png"
end
|