Module: Attach::ModelExtension::InstanceMethods

Defined in:
lib/attach/model_extension/instance_methods.rb

Instance Method Summary collapse

Instance Method Details

#process_pending_attachmentsObject



9
10
11
12
13
14
15
16
# File 'lib/attach/model_extension/instance_methods.rb', line 9

def process_pending_attachments
  attachments.where(role: @pending_attachment_deletions).destroy_all if @pending_attachment_deletions

  return if @pending_attachments.nil? || @pending_attachments.empty?

  @pending_attachments.each_value(&:save!)
  @pending_attachments = nil
end