Files
fizzy/app/models/account/searchable.rb
T
Mike Dalessio 9a27ca8b42 Scope clear_search_records to the account being destroyed (#2847)
Account::Searchable#clear_search_records called
Search::Record.for(id).destroy_all which deleted every row in the
shard's table, wiping search records belonging to every other account
that happened to hash to the same shard.

ref: https://3.basecamp.com/2914079/buckets/27/card_tables/cards/9782824728
2026-04-16 15:43:55 -04:00

15 lines
319 B
Ruby

module Account::Searchable
extend ActiveSupport::Concern
included do
has_many :search_queries, class_name: "Search::Query", dependent: :delete_all
before_destroy :clear_search_records
end
private
def clear_search_records
Search::Record.for(id).where(account_id: id).destroy_all
end
end