9a27ca8b42
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
15 lines
319 B
Ruby
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
|