Sha256: a939b8d068cc7c802c48fe7fa6bb0d277e60c10299f2dc458284be7f943390f1

Contents?: true

Size: 451 Bytes

Versions: 71

Compression:

Stored size: 451 Bytes

Contents

# frozen_string_literal: true

module ActiveStorage
  class Attached::Changes::DetachMany # :nodoc:
    attr_reader :name, :record, :attachments

    def initialize(name, record, attachments)
      @name, @record, @attachments = name, record, attachments
    end

    def detach
      if attachments.any?
        attachments.delete_all if attachments.respond_to?(:delete_all)
        record.attachment_changes.delete(name)
      end
    end
  end
end

Version data entries

71 entries across 68 versions & 6 rubygems

Version Path
activestorage-7.0.2.3 lib/active_storage/attached/changes/detach_many.rb
activestorage-7.0.2.2 lib/active_storage/attached/changes/detach_many.rb
activestorage-7.0.2.1 lib/active_storage/attached/changes/detach_many.rb
activestorage-7.0.2 lib/active_storage/attached/changes/detach_many.rb
activestorage-7.0.1 lib/active_storage/attached/changes/detach_many.rb
activestorage-7.0.0 lib/active_storage/attached/changes/detach_many.rb
activestorage-7.0.0.rc3 lib/active_storage/attached/changes/detach_many.rb
activestorage-7.0.0.rc2 lib/active_storage/attached/changes/detach_many.rb
activestorage-7.0.0.rc1 lib/active_storage/attached/changes/detach_many.rb
activestorage-7.0.0.alpha2 lib/active_storage/attached/changes/detach_many.rb
activestorage-7.0.0.alpha1 lib/active_storage/attached/changes/detach_many.rb