global fixtures are evil, but we’ve got a bunch of unit tests depending on them, so we still need them around
here’s a neat [and generally fast, though a degenerate O(#tables^2) case is possible] way of deleting all fixtures without invoking db dependent ways of ignoring foreign-key constraints, and without loading all the objects into memory :
classes = ActiveRecord::Base.connection.tables.map {|t|
t.singularize.camelize.constantize rescue nil
}.compact.reject{|cls| !cls.ancestors.include?(ActiveRecord::Base)}
while classes.size > 0
classes = classes.select{|c|
begin
c.delete_all
false
rescue
true
end
}.reverse!
end
