Files

ActiveRecord::ConnectionAdapters::PostgreSQLAdapter

Public Class Methods

cascade() click to toggle source
# File lib/database_cleaner/active_record/truncation.rb, line 45
def self.cascade
  @cascade ||= db_version >=  "08.02" ? "CASCADE" : ""
end
db_version() click to toggle source
# File lib/database_cleaner/active_record/truncation.rb, line 38
def self.db_version
  @db_version ||= ActiveRecord::Base.connection.select_values(
    "SELECT CHARACTER_VALUE 
      FROM INFORMATION_SCHEMA.SQL_IMPLEMENTATION_INFO 
      WHERE IMPLEMENTATION_INFO_NAME = 'DBMS VERSION' ").to_s
end

Public Instance Methods

truncate_table(table_name) click to toggle source
# File lib/database_cleaner/active_record/truncation.rb, line 49
def truncate_table(table_name)
  execute("TRUNCATE TABLE #{quote_table_name(table_name)} #{self.class.cascade};")
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.