Database clearing

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

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.

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:

Scott