delete_or_destroy(records, method) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/associations/collection_association.rb, line 436
        def delete_or_destroy(records, method)
          records = records.flatten
          records.each { |record| raise_on_type_mismatch(record) }
          existing_records = records.reject { |r| r.new_record? }

          transaction do
            records.each { |record| callback(:before_remove, record) }

            delete_records(existing_records, method) if existing_records.any?
            records.each { |record| target.delete(record) }

            records.each { |record| callback(:after_remove, record) }
          end
        end
Register or log in to add new notes.