Sha256: 44ed24cb35f6bf22efbce7eb07900652e312ced64fb00b04cee00c1af6206ea4

Contents?: true

Size: 429 Bytes

Versions: 22

Compression:

Stored size: 429 Bytes

Contents

# frozen_string_literal: true

module ActiveStorage
  class Attached::Changes::CreateOneOfMany < Attached::Changes::CreateOne # :nodoc:
    private
      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
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
activestorage-8.0.2 lib/active_storage/attached/changes/create_one_of_many.rb
activestorage-8.0.1 lib/active_storage/attached/changes/create_one_of_many.rb
activestorage-8.0.0.1 lib/active_storage/attached/changes/create_one_of_many.rb
activestorage-7.2.2.1 lib/active_storage/attached/changes/create_one_of_many.rb
activestorage-8.0.0 lib/active_storage/attached/changes/create_one_of_many.rb
activestorage-7.2.2 lib/active_storage/attached/changes/create_one_of_many.rb
activestorage-8.0.0.rc2 lib/active_storage/attached/changes/create_one_of_many.rb
activestorage-7.2.1.2 lib/active_storage/attached/changes/create_one_of_many.rb
activestorage-8.0.0.rc1 lib/active_storage/attached/changes/create_one_of_many.rb
activestorage-7.2.1.1 lib/active_storage/attached/changes/create_one_of_many.rb
activestorage-8.0.0.beta1 lib/active_storage/attached/changes/create_one_of_many.rb
omg-activestorage-8.0.0.alpha9 lib/active_storage/attached/changes/create_one_of_many.rb
omg-activestorage-8.0.0.alpha8 lib/active_storage/attached/changes/create_one_of_many.rb
omg-activestorage-8.0.0.alpha7 lib/active_storage/attached/changes/create_one_of_many.rb
omg-activestorage-8.0.0.alpha4 lib/active_storage/attached/changes/create_one_of_many.rb
omg-activestorage-8.0.0.alpha3 lib/active_storage/attached/changes/create_one_of_many.rb
activestorage-7.2.1 lib/active_storage/attached/changes/create_one_of_many.rb
activestorage-7.2.0 lib/active_storage/attached/changes/create_one_of_many.rb
activestorage-7.2.0.rc1 lib/active_storage/attached/changes/create_one_of_many.rb
activestorage-7.2.0.beta3 lib/active_storage/attached/changes/create_one_of_many.rb