Sha256: 349a1d742aae912658aaedff582470bfaacbcc2010404af56a45064680493a0c

Contents?: true

Size: 631 Bytes

Versions: 2

Compression:

Stored size: 631 Bytes

Contents

require 'active_record/base'
require 'active_record/connection_adapters/abstract_adapter'
require "database_cleaner/generic/truncation"
require 'database_cleaner/active_record/base'
require 'database_cleaner/active_record/truncation'

module DatabaseCleaner::ActiveRecord
  class Deletion < Truncation

    def clean
      connection = connection_class.connection
      connection.disable_referential_integrity do
        sql = tables_to_truncate(connection).map do |table_name|
          "DELETE FROM #{connection.quote_table_name(table_name)}"
        end.join(";")

        connection.execute sql
      end
    end

  end
end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
database_cleaner-1.0.1 lib/database_cleaner/active_record/deletion.rb
database_cleaner-1.0.0.RC1 lib/database_cleaner/active_record/deletion.rb