Class: ActiveShrine::Attached::Changes::CreateMany

Inherits:
Object
  • Object
show all
Defined in:
lib/active_shrine/attached/changes/create_many.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, record, attachables, pending_uploads: []) ⇒ CreateMany

Returns a new instance of CreateMany.



9
10
11
12
13
14
15
# File 'lib/active_shrine/attached/changes/create_many.rb', line 9

def initialize(name, record, attachables, pending_uploads: [])
  @name = name
  @record = record
  @attachables = Array(attachables)
  @pending_uploads = Array(pending_uploads) + subchanges
  attachments
end

Instance Attribute Details

#attachablesObject (readonly)

Returns the value of attribute attachables.



7
8
9
# File 'lib/active_shrine/attached/changes/create_many.rb', line 7

def attachables
  @attachables
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/active_shrine/attached/changes/create_many.rb', line 7

def name
  @name
end

#pending_uploadsObject (readonly)

Returns the value of attribute pending_uploads.



7
8
9
# File 'lib/active_shrine/attached/changes/create_many.rb', line 7

def pending_uploads
  @pending_uploads
end

#recordObject (readonly)

Returns the value of attribute record.



7
8
9
# File 'lib/active_shrine/attached/changes/create_many.rb', line 7

def record
  @record
end

Instance Method Details

#attachmentsObject



17
18
19
# File 'lib/active_shrine/attached/changes/create_many.rb', line 17

def attachments
  @attachments ||= subchanges.collect(&:attachment)
end

#saveObject



21
22
23
# File 'lib/active_shrine/attached/changes/create_many.rb', line 21

def save
  assign_associated_attachments
end