Class: DatabaseCleaner::ActiveRecord::Truncation
- Inherits:
-
Object
- Object
- DatabaseCleaner::ActiveRecord::Truncation
show all
- Includes:
- Base, Generic::Truncation
- Defined in:
- lib/database_cleaner/active_record/truncation.rb
Instance Attribute Summary
Attributes included from Base
#connection_hash
Instance Method Summary
collapse
included
Methods included from Base
#connection_klass, #create_connection_klass, #db, #db=, #load_config
included
Instance Method Details
#clean ⇒ Object
105
106
107
108
109
|
# File 'lib/database_cleaner/active_record/truncation.rb', line 105
def clean
each_table do |connection, table_name|
connection.truncate_table table_name
end
end
|
#each_table ⇒ Object
111
112
113
114
115
116
117
118
|
# File 'lib/database_cleaner/active_record/truncation.rb', line 111
def each_table
connection = connection_klass.connection
connection.disable_referential_integrity do
tables_to_truncate(connection).each do |table_name|
yield connection, table_name
end
end
end
|