Skip to content

Commit

Permalink
fix for issue #68
Browse files Browse the repository at this point in the history
  • Loading branch information
mceachen committed Jul 20, 2013
1 parent 4ca376d commit e22bc25
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/closure_tree/hierarchy_maintenance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def rebuild!
SQL
end
# Resetting the ancestral collections addresses https://github.com/mceachen/closure_tree/issues/68
self.ancestor_hierarchies.reset
self.self_and_ancestors.reset
self.ancestor_hierarchies._ct_reset
self.self_and_ancestors._ct_reset
children.each { |c| c.rebuild! }
_ct_reorder_children if _ct.order_is_numeric?
end
Expand Down Expand Up @@ -98,3 +98,14 @@ def rebuild!
end
end
end

# Horrible monkeypatch to address https://github.com/mceachen/closure_tree/issues/68
module ActiveRecord
module Associations
class CollectionProxy
def _ct_reset
@association.reset
end
end
end
end

0 comments on commit e22bc25

Please sign in to comment.