Class: ActivestorageDelayed::DelayedUploader
- Inherits:
-
Object
- Object
- ActivestorageDelayed::DelayedUploader
- Defined in:
- lib/activestorage-delayed/delayed_uploader.rb
Instance Attribute Summary collapse
-
#delayed_upload ⇒ Object
readonly
Returns the value of attribute delayed_upload.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(delayed_upload_id) ⇒ DelayedUploader
constructor
A new instance of DelayedUploader.
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_upload ⇒ Object (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
#call ⇒ Object
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 |