app/models/flexible_feeds/event.rb in flexible_feeds-0.3.0 vs app/models/flexible_feeds/event.rb in flexible_feeds-0.3.1

- old
+ new

@@ -42,17 +42,23 @@ votes_for + votes_against) save end def increment_parent_counter - ancestors.each do |this_ancestor| - this_ancestor.increment(:children_count) + FlexibleFeeds::Event.transaction do + ancestors.each do |this_ancestor| + this_ancestor.increment(:children_count) + this_ancestor.save! + end end end def decrement_parent_counter - ancestors.each do |this_ancestor| - this_ancestor.decrement(:children_count, children_count + 1) + FlexibleFeeds::Event.transaction do + ancestors.each do |this_ancestor| + this_ancestor.decrement(:children_count, children_count + 1) + this_ancestor.save! + end end end private def calculate_controversy(pos, neg)