Permalink
Browse files

add `reset_counter_cache` to ManyProxy

  • Loading branch information...
1 parent f83e5a1 commit ae9c29da8301f40d5a85d1b34e75f650c5177305 @mislav committed Sep 20, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/mingo/many_proxy.rb
@@ -95,7 +95,13 @@ def find(selector = {}, options = {}, &block)
def respond_to?(method, priv = false)
super || method_missing(:respond_to?, method, priv)
end
-
+
+ def reset_counter_cache
+ delta = join_cursor.count - counter_cache
+ change_counter_cache delta
+ counter_cache
+ end
+
private
def method_missing(method, *args, &block)

0 comments on commit ae9c29d

Please sign in to comment.