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
50 51 52 53 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 50 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
42 43 44 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 42 def truncate_table(table_name) execute("TRUNCATE TABLE #{quote_table_name(table_name)};") end |
#truncate_tables(tables) ⇒ Object
46 47 48 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 46 def truncate_tables(tables) tables.each { |t| truncate_table(t) } end |