Skip to content

Commit

Permalink
Merge branch 'core' into core
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieujobin authored Mar 12, 2024
2 parents 7b37b29 + de74493 commit 6f36f52
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/paranoia.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,25 @@ def really_destroy!(update_destroy_attributes: true)

private

def counter_cache_disabled?
defined?(@_disable_counter_cache) && @_disable_counter_cache
end

def counter_cached_association_names
return [] if counter_cache_disabled?
super
end

def each_counter_cached_associations
!(defined?(@_disable_counter_cache) && @_disable_counter_cache) ? super : []
return [] if counter_cache_disabled?

if defined?(super)
super
else
counter_cached_association_names.each do |name|
yield association(name)
end
end
end

def paranoia_restore_attributes
Expand Down

0 comments on commit 6f36f52

Please sign in to comment.