corrects the superclass for the AR connection adapters

This commit is contained in:
Ben Mabey 2010-03-21 11:30:17 -06:00
parent 7671242b31
commit 4648d0b89c
2 changed files with 15 additions and 8 deletions

View File

@ -1,10 +1,11 @@
0.5.x (In Git)
=== New features
* clean and clean_with methods are now aliased to clean! and clean_with!. (Ben Mabey)
* Clean and clean_with methods are now aliased to clean! and clean_with!. (Ben Mabey)
=== Bugfixes
* check PostgreSQL version >= 8.2 before using TRUNCATE CASCADE (James B. Byrne)
* Check PostgreSQL version >= 8.2 before using TRUNCATE CASCADE (James B. Byrne)
* Correct superclass is used in ActiveRecord connection adapters. (johnathan, Aslak Hellesoy, Ben Mabey)
== 0.5.0 2010-02-22 - The CouchPotato Release

View File

@ -3,19 +3,25 @@ require "database_cleaner/truncation_base"
module ActiveRecord
module ConnectionAdapters
class MysqlAdapter
class AbstractAdapter
end
class SQLiteAdapter < AbstractAdapter
end
class MysqlAdapter < AbstractAdapter
def truncate_table(table_name)
execute("TRUNCATE TABLE #{quote_table_name(table_name)};")
end
end
class SQLite3Adapter
class SQLite3Adapter < SQLiteAdapter
def truncate_table(table_name)
execute("DELETE FROM #{quote_table_name(table_name)};")
end
end
class JdbcAdapter
class JdbcAdapter < AbstractAdapter
def truncate_table(table_name)
begin
execute("TRUNCATE TABLE #{quote_table_name(table_name)};")
@ -25,7 +31,7 @@ module ActiveRecord
end
end
class PostgreSQLAdapter
class PostgreSQLAdapter < AbstractAdapter
def self.db_version
@db_version ||= ActiveRecord::Base.connection.select_values(
@ -44,13 +50,13 @@ module ActiveRecord
end
class SQLServerAdapter
class SQLServerAdapter < AbstractAdapter
def truncate_table(table_name)
execute("TRUNCATE TABLE #{quote_table_name(table_name)};")
end
end
class OracleEnhancedAdapter
class OracleEnhancedAdapter < AbstractAdapter
def truncate_table(table_name)
execute("TRUNCATE TABLE #{quote_table_name(table_name)}")
end