lib/counter/integration/countable.rb in counterwise-0.1.1 vs lib/counter/integration/countable.rb in counterwise-0.1.2

- old
+ new

@@ -24,9 +24,11 @@ # Iterate over each counter that needs to be updated for this model # expects a block that takes a counter as an argument def each_counter_to_update # For each definition, find or create the counter on the parent self.class.counted_by.each do |counter_definition| + next unless counter_definition.inverse_association + parent_association = association(counter_definition.inverse_association) parent_association.load_target unless parent_association.loaded? parent_model = parent_association.target next unless parent_model counter = parent_model.counters.find_or_create_counter!(counter_definition)