diff --git a/lib/permanent_records.rb b/lib/permanent_records.rb index 6851f7e..8552786 100644 --- a/lib/permanent_records.rb +++ b/lib/permanent_records.rb @@ -106,7 +106,7 @@ def set_deleted_at(value, force = nil) end def each_counter_cache - _reflections.each do |name, reflection| + PermanentRecords.dependent_permanent_reflections(self.class).each do |name, reflection| association = send(name.to_sym) next if association.nil? next unless reflection.belongs_to? && reflection.counter_cache_column