tdd2110
September 21, 2008, 2:50am
21
Scott T. wrote:
# Or whatever you think is appropriate.
(ActiveRecord::Base.connection.tables - %w{schema_migrations}).each do
|table_name|
Yeah, that’s just a cleaner way of doing it - I’m sure if you tailed
your logs you’d find a ‘SHOW TABLES’
Yeah, depending on the rails environment it probably and caching it
probably would.
ActiveRecord::Base.connection.execute(“TRUNCATE TABLE #{table_name};”)
Seems like you might also want to add a truncate_table method onto
ActiveRecord::Base.
Yeah, I tend to ussually add this to my projects as well:
class ActiveRecord::Base
class << self
def truncate
self.connection.execute("TRUNCATE TABLE #{table_name};")
end
end
end
tdd2110
September 21, 2008, 2:53am
22
Ben M. wrote:
config.after(:each) do
is not needed:
probably would.
English FAIL. I meant to say:
Yeah, depending on the rails environment and caching settings it
probably would.
tdd2110
September 21, 2008, 8:52am
23
On Sep 20, 2008, at 8:53 PM, Ben M. wrote:
spec_helper.rb):
Yeah, that’s just a cleaner way of doing it - I’m sure if you tailed
probably would.
Does ActiveRecord cache table names? I’m well aware of it caching
table columns:
# SMTMigrationExtensions Copyright (C) 2008 Scott Taylor <[email protected] >
module SMT
module MigrationFixes
MAJOR = 1
MINOR = 1
TINY = 0
VERSION = "#{MAJOR}.#{MINOR}.#{TINY}"
module MigrationMethods
def self.extended(other_mod)
other_mod.instance_eval do
class << self
unless instance_methods.include?("old_migrate")
alias_method :old_migrate, :migrate
def migrate(*args, &blk)
result = old_migrate(*args, &blk)
reset_class_information
This file has been truncated. show original
Scott