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
83
84
85
|
# File 'app/models/concerns/spree/active_storage_adapter.rb', line 83
def default_style
self.class.attachment_definition[:default_style]
end
|
#destroy_attachment(_name) ⇒ Object
97
98
99
|
# File 'app/models/concerns/spree/active_storage_adapter.rb', line 97
def destroy_attachment(_name)
attachment.destroy
end
|
#filename ⇒ Object
87
88
89
|
# File 'app/models/concerns/spree/active_storage_adapter.rb', line 87
def filename
attachment.filename
end
|
#styles ⇒ Object
79
80
81
|
# File 'app/models/concerns/spree/active_storage_adapter.rb', line 79
def styles
self.class.attachment_definition[:styles]
end
|
#url(style = default_style) ⇒ Object
91
92
93
94
95
|
# File 'app/models/concerns/spree/active_storage_adapter.rb', line 91
def url(style = default_style)
attachment.url(style)
rescue ActiveStorage::FileNotFoundError
"noimage/#{style}.png"
end
|