From 3ccc9a8767e84e9fcde979ed2a759c28e45829ed Mon Sep 17 00:00:00 2001 From: David Demaree Date: Sun, 8 Jan 2012 19:36:29 -0600 Subject: [PATCH] Fixed Rails 3.2 superclass mismatch error --- lib/database_cleaner/active_record/truncation.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/database_cleaner/active_record/truncation.rb b/lib/database_cleaner/active_record/truncation.rb index 76ec0fe..58345db 100755 --- a/lib/database_cleaner/active_record/truncation.rb +++ b/lib/database_cleaner/active_record/truncation.rb @@ -29,7 +29,15 @@ module ActiveRecord end end - MYSQL_ADAPTER_PARENT = USE_ARJDBC_WORKAROUND ? JdbcAdapter : AbstractAdapter + # ActiveRecord 3.1 support + if defined?(AbstractMysqlAdapter) + MYSQL_ADAPTER_PARENT = USE_ARJDBC_WORKAROUND ? JdbcAdapter : AbstractMysqlAdapter + MYSQL2_ADAPTER_PARENT = AbstractMysqlAdapter + else + MYSQL_ADAPTER_PARENT = USE_ARJDBC_WORKAROUND ? JdbcAdapter : AbstractAdapter + MYSQL2_ADAPTER_PARENT = AbstractAdapter + end + SQLITE_ADAPTER_PARENT = USE_ARJDBC_WORKAROUND ? JdbcAdapter : SQLiteAdapter POSTGRE_ADAPTER_PARENT = USE_ARJDBC_WORKAROUND ? JdbcAdapter : AbstractAdapter @@ -39,7 +47,7 @@ module ActiveRecord end end - class Mysql2Adapter < AbstractAdapter + class Mysql2Adapter < MYSQL2_ADAPTER_PARENT def truncate_table(table_name) execute("TRUNCATE TABLE #{quote_table_name(table_name)};") end