Class: DatabaseCleaner::ActiveRecord::Deletion

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

Instance Attribute Summary

Attributes included from Base

#connection_hash

Instance Method Summary collapse

Methods included from SelectiveTruncation

#information_schema_exists?, #table_stats_query, #tables_to_truncate, #tables_with_new_rows

Methods included from Generic::Truncation

#initialize, #start

Methods included from Base

#connection_class, #db, #db=, exclusion_condition, #load_config, migration_table_name, #valid_config

Methods included from Generic::Base

#cleaning, #db, included

Instance Method Details

#cleanObject



99
100
101
102
103
104
105
106
# File 'lib/database_cleaner/active_record/deletion.rb', line 99

def clean
  connection = connection_class.connection
  connection.disable_referential_integrity do
    tables_to_truncate(connection).each do |table_name|
      connection.delete_table table_name
    end
  end
end