Class: ActiveStorage::Attached::Changes::CreateMany
- Defined in:
 - activestorage/lib/active_storage/attached/changes/create_many.rb
 
Overview
:nodoc:
Instance Attribute Summary collapse
- 
  
    
      #attachables  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute attachables.
 - 
  
    
      #name  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute name.
 - 
  
    
      #pending_uploads  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute pending_uploads.
 - 
  
    
      #record  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute record.
 
Instance Method Summary collapse
- #attachments ⇒ Object
 - #blobs ⇒ Object
 - 
  
    
      #initialize(name, record, attachables, pending_uploads: [])  ⇒ CreateMany 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of CreateMany.
 - #save ⇒ Object
 - #upload ⇒ Object
 
Constructor Details
#initialize(name, record, attachables, pending_uploads: []) ⇒ CreateMany
Returns a new instance of CreateMany.
      7 8 9 10 11 12  | 
    
      # File 'activestorage/lib/active_storage/attached/changes/create_many.rb', line 7 def initialize(name, record, attachables, pending_uploads: []) @name, @record, @attachables = name, record, Array(attachables) blobs.each(&:identify_without_saving) @pending_uploads = Array(pending_uploads) + subchanges_without_blobs end  | 
  
Instance Attribute Details
#attachables ⇒ Object (readonly)
Returns the value of attribute attachables.
      5 6 7  | 
    
      # File 'activestorage/lib/active_storage/attached/changes/create_many.rb', line 5 def attachables @attachables end  | 
  
#name ⇒ Object (readonly)
Returns the value of attribute name.
      5 6 7  | 
    
      # File 'activestorage/lib/active_storage/attached/changes/create_many.rb', line 5 def name @name end  | 
  
#pending_uploads ⇒ Object (readonly)
Returns the value of attribute pending_uploads.
      5 6 7  | 
    
      # File 'activestorage/lib/active_storage/attached/changes/create_many.rb', line 5 def pending_uploads @pending_uploads end  | 
  
#record ⇒ Object (readonly)
Returns the value of attribute record.
      5 6 7  | 
    
      # File 'activestorage/lib/active_storage/attached/changes/create_many.rb', line 5 def record @record end  | 
  
Instance Method Details
#attachments ⇒ Object
      14 15 16  | 
    
      # File 'activestorage/lib/active_storage/attached/changes/create_many.rb', line 14 def @attachments ||= subchanges.collect(&:attachment) end  | 
  
#blobs ⇒ Object
      18 19 20  | 
    
      # File 'activestorage/lib/active_storage/attached/changes/create_many.rb', line 18 def blobs @blobs ||= subchanges.collect(&:blob) end  | 
  
#save ⇒ Object
      26 27 28 29  | 
    
      # File 'activestorage/lib/active_storage/attached/changes/create_many.rb', line 26 def save reset_associated_blobs end  | 
  
#upload ⇒ Object
      22 23 24  | 
    
      # File 'activestorage/lib/active_storage/attached/changes/create_many.rb', line 22 def upload pending_uploads.each(&:upload) end  |