Permalink
Browse files

Patch for the pg truncation adapter to prevent an emtpy list of table…

…s from

generating an illegal TRUCATE TABLE statement.
  • Loading branch information...
1 parent fd3dc63 commit 1f3a68fbbae452ec50831445846e557e7411d47d Michael-Keith Bernard committed Mar 8, 2012
Showing with 1 addition and 0 deletions.
  1. +1 −0 lib/database_cleaner/active_record/truncation.rb
@@ -96,6 +96,7 @@ def truncate_table(table_name)
end
def truncate_tables(table_names)
+ return if table_names.nil? || table_names.empty?
execute("TRUNCATE TABLE #{table_names.map{|name| quote_table_name(name)}.join(', ')} #{restart_identity} #{cascade};")
end

0 comments on commit 1f3a68f

Please sign in to comment.