Clear Rails cache for destroyed comment's ancestors and destroy buffer_updates for articles (#3065)
* Touch all ancestors before destroying comment * Destroy buffer_updates when article is destroyed
This commit is contained in:
parent
6e1c568483
commit
141c8f27d2
2 changed files with 2 additions and 1 deletions
|
|
@ -22,7 +22,7 @@ class Article < ApplicationRecord
|
|||
counter_culture :organization
|
||||
|
||||
has_many :comments, as: :commentable, inverse_of: :commentable
|
||||
has_many :buffer_updates
|
||||
has_many :buffer_updates, dependent: :destroy
|
||||
has_many :notifications, as: :notifiable, inverse_of: :notifiable
|
||||
has_many :rating_votes
|
||||
has_many :page_views
|
||||
|
|
|
|||
|
|
@ -251,6 +251,7 @@ class Comment < ApplicationRecord
|
|||
|
||||
def before_destroy_actions
|
||||
commentable.touch(:last_comment_at) if commentable.respond_to?(:last_comment_at)
|
||||
ancestors.update_all(updated_at: Time.current)
|
||||
remove_notifications
|
||||
bust_cache_without_delay
|
||||
remove_algolia_index
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue