Module: DatabaseCleaner::ConnectionAdapters::TruncateOrDelete
- Defined in:
- lib/database_cleaner/active_record/truncation.rb
Instance Method Summary collapse
Instance Method Details
#truncate_table(table_name) ⇒ Object
114 115 116 117 118 119 120 |
# File 'lib/database_cleaner/active_record/truncation.rb', line 114 def truncate_table(table_name) begin execute("TRUNCATE TABLE #{quote_table_name(table_name)};") rescue ::ActiveRecord::StatementInvalid execute("DELETE FROM #{quote_table_name(table_name)};") end end |