Module: DatabaseCleaner::ConnectionAdapters::AbstractMysqlAdapter
- Defined in:
- lib/database_cleaner/active_record/truncation.rb
Instance Method Summary collapse
- #pre_count_truncate_tables(tables, options = {:reset_ids => true}) ⇒ Object
- #truncate_table(table_name) ⇒ Object
- #truncate_tables(tables) ⇒ Object
Instance Method Details
#pre_count_truncate_tables(tables, options = {:reset_ids => true}) ⇒ Object
58 59 60 61 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 58 def pre_count_truncate_tables(tables, = {:reset_ids => true}) filter = [:reset_ids] ? method(:has_been_used?) : method(:has_rows?) truncate_tables(tables.select(&filter)) end |
#truncate_table(table_name) ⇒ Object
50 51 52 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 50 def truncate_table(table_name) execute("TRUNCATE TABLE #{quote_table_name(table_name)};") end |
#truncate_tables(tables) ⇒ Object
54 55 56 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 54 def truncate_tables(tables) tables.each { |t| truncate_table(t) } end |