Commit a7a3ce2e authored by Micaël Bergeron's avatar Micaël Bergeron

delegate the ObjectStorage upload fetching

parent d5aebda4
......@@ -20,11 +20,17 @@ module ObjectStorage
module RecordsUploads
extend ActiveSupport::Concern
included do |base|
prepended do |base|
raise ObjectStoreUnavailable, "#{base} must include ObjectStorage::Concern to use extensions." unless base < Concern
base.include(::RecordsUploads::Concern)
end
def initialize(model = nil, mounted_as = nil)
super
self.upload = model&.try(:"#{mounted_as}_upload", self) if mounted_as
end
def upload=(upload)
return unless upload
......@@ -45,12 +51,6 @@ module ObjectStorage
attr_reader :object_store
def initialize(model=nil, mounted_as=nil)
super
self.upload = model&.try(:"#{mounted_as}_upload", self)
end
class_methods do
def object_store_options
storage_options&.object_store
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment