123456789_123456789_123456789_123456789_123456789_

Class: ActiveStorage::Attached::Changes::CreateOneOfMany

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, CreateOne
Instance Chain:
self, CreateOne
Inherits: ActiveStorage::Attached::Changes::CreateOne
Defined in: activestorage/lib/active_storage/attached/changes/create_one_of_many.rb

Class Method Summary

CreateOne - Inherited

Instance Attribute Summary

Instance Method Summary

Constructor Details

This class inherits a constructor from ActiveStorage::Attached::Changes::CreateOne

Instance Method Details

#find_attachment (private)

[ GitHub ]

  
# File 'activestorage/lib/active_storage/attached/changes/create_one_of_many.rb', line 6

def find_attachment
  if blob.persisted?
    record.public_send("#{name}_attachments").detect { |attachment| attachment.blob_id == blob.id }
  else
    blob.attachments.find { |attachment| attachment.record == record }
  end
end