fix: Invalidate cache if any of the related objects change (#6860)

* fix: Invalidate cache if any of the related objects change

* Add specs:

* Update context

---------

Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
This commit is contained in:
Pranav Raj S
2023-04-10 03:17:13 -07:00
committed by GitHub
parent da11feb39b
commit e877b01e00
3 changed files with 23 additions and 4 deletions

View File

@@ -2,9 +2,7 @@ module AccountCacheRevalidator
extend ActiveSupport::Concern
included do
after_save :update_account_cache
after_destroy :update_account_cache
after_create :update_account_cache
after_commit :update_account_cache
end
def update_account_cache

View File

@@ -3,7 +3,7 @@ module Channelable
included do
validates :account_id, presence: true
belongs_to :account
has_one :inbox, as: :channel, dependent: :destroy_async
has_one :inbox, as: :channel, dependent: :destroy_async, touch: true
end
def messaging_window_enabled?