Class: ActivestorageDelayed::DelayedUploader

Inherits:
Object
  • Object
show all
Defined in:
lib/activestorage-delayed/delayed_uploader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(delayed_upload_id) ⇒ DelayedUploader

Returns a new instance of DelayedUploader.



7
8
9
10
# File 'lib/activestorage-delayed/delayed_uploader.rb', line 7

def initialize(delayed_upload_id)
  @delayed_upload = delayed_upload_id if delayed_upload_id.is_a?(ActiveRecord::Base)
  @delayed_upload ||= DelayedUpload.find_by(id: delayed_upload_id)
end

Instance Attribute Details

#delayed_uploadObject (readonly)

Returns the value of attribute delayed_upload.



5
6
7
# File 'lib/activestorage-delayed/delayed_uploader.rb', line 5

def delayed_upload
  @delayed_upload
end

Instance Method Details

#callObject



12
13
14
15
16
17
# File 'lib/activestorage-delayed/delayed_uploader.rb', line 12

def call
  return unless delayed_upload

  remove_files
  save_changes if upload_photos
end