Overriding couchrest's database delete method to ensure design cache is deleted
This commit is contained in:
parent
9754f4633c
commit
fba1e53e20
5 changed files with 19 additions and 2 deletions
|
@ -108,8 +108,6 @@ module CouchRest
|
|||
}
|
||||
end
|
||||
|
||||
|
||||
|
||||
end # module ClassMethods
|
||||
|
||||
end
|
||||
|
|
13
lib/couchrest/model/support/couchrest_database.rb
Normal file
13
lib/couchrest/model/support/couchrest_database.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue