Overriding couchrest's database delete method to ensure design cache is deleted

This commit is contained in:
Sam Lown 2011-05-19 00:37:17 +02:00
parent 9754f4633c
commit fba1e53e20
5 changed files with 19 additions and 2 deletions

View file

@ -108,8 +108,6 @@ module CouchRest
}
end
end # module ClassMethods
end

View file

@ -0,0 +1,13 @@
#
# Extend CouchRest's normal database delete! method to ensure any caches are
# also emptied. Given that this is a rare event, and the consequences are not
# very severe, we just completely empty the cache.
#
CouchRest::Database.class_eval do
def delete!
Thread.current[:couchrest_design_cache] = { }
CouchRest.delete @root
end
end