Extract shared callback behaviour to CustomFilterCache concern (#29695)

This commit is contained in:
Matt Jankowski 2024-04-05 05:17:58 -04:00 committed by GitHub
parent 285a87a77f
commit c0fe8a9f13
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 24 deletions

View file

@ -0,0 +1,17 @@
# frozen_string_literal: true
module CustomFilterCache
extend ActiveSupport::Concern
included do
after_commit :invalidate_cache!
before_destroy :prepare_cache_invalidation!
before_save :prepare_cache_invalidation!
delegate(
:invalidate_cache!,
:prepare_cache_invalidation!,
to: :custom_filter
)
end
end