Class: DatabaseCleaner::ActiveRecord::Truncation
- Inherits:
-
Object
- Object
- DatabaseCleaner::ActiveRecord::Truncation
- Includes:
- Base, Generic::Truncation
- Defined in:
- lib/database_cleaner/active_record/truncation.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes included from Base
Instance Method Summary collapse
Methods included from Generic::Truncation
Methods included from Base
#connection_class, #db, #db=, #load_config, #valid_config
Methods included from Generic::Base
Instance Method Details
#clean ⇒ Object
233 234 235 236 237 238 239 240 241 242 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 233 def clean connection = connection_class.connection connection.disable_referential_integrity do if pre_count? && connection.respond_to?(:pre_count_truncate_tables) connection.pre_count_truncate_tables(tables_to_truncate(connection), {:reset_ids => reset_ids?}) else connection.truncate_tables(tables_to_truncate(connection)) end end end |