diff --git a/lib/identity_cache/parent_model_expiration.rb b/lib/identity_cache/parent_model_expiration.rb index a8e290ee..fcd9e0e0 100644 --- a/lib/identity_cache/parent_model_expiration.rb +++ b/lib/identity_cache/parent_model_expiration.rb @@ -41,17 +41,6 @@ def parent_expiration_entries ParentModelExpiration.install_pending_parent_expiry_hooks(cached_model) _parent_expiration_entries end - - def check_for_unsupported_parent_expiration_entries - return unless parent_expiration_entries.any? - msg = +"Unsupported manual expiration of #{name} record that is embedded in parent associations:\n" - parent_expiration_entries.each do |association_name, cached_associations| - cached_associations.each do |parent_class, _only_on_foreign_key_change| - msg << "- #{association_name}" - end - end - raise msg - end end included do diff --git a/lib/identity_cache/without_primary_index.rb b/lib/identity_cache/without_primary_index.rb index 3c0af040..05702dc0 100644 --- a/lib/identity_cache/without_primary_index.rb +++ b/lib/identity_cache/without_primary_index.rb @@ -75,6 +75,19 @@ def expire_cache_for_update(old_indexed_values, changes) alias_method :expire_cache_for_insert, :expire_cache_for_insert_or_delete alias_method :expire_cache_for_delete, :expire_cache_for_insert_or_delete + + private + + def check_for_unsupported_parent_expiration_entries + return unless parent_expiration_entries.any? + msg = +"Unsupported manual expiration of #{name} record that is embedded in parent associations:\n" + parent_expiration_entries.each do |association_name, cached_associations| + cached_associations.each do |parent_class, _only_on_foreign_key_change| + msg << "- #{association_name}" + end + end + raise msg + end end end end