Class: DatabaseCleaner::ActiveRecord::Deletion

Inherits:
Truncation
  • Object
show all
Defined in:
lib/database_cleaner/active_record/deletion.rb

Instance Attribute Summary

Attributes inherited from Base

#connection_hash

Instance Method Summary collapse

Methods inherited from Truncation

#initialize

Methods inherited from Base

#connection_class, #db=, exclusion_condition, migration_table_name

Constructor Details

This class inherits a constructor from DatabaseCleaner::ActiveRecord::Truncation

Instance Method Details

#cleanObject



7
8
9
10
11
12
13
14
15
# File 'lib/database_cleaner/active_record/deletion.rb', line 7

def clean
  connection.disable_referential_integrity do
    if pre_count? && connection.respond_to?(:pre_count_tables)
      delete_tables(connection, connection.pre_count_tables(tables_to_clean(connection)))
    else
      delete_tables(connection, tables_to_clean(connection))
    end
  end
end