Files
fizzy/app/models/card/searchable.rb
T
Donal McBreen b571303385 Don't use Current.account for search records
It doesn't actually work, and even if we could make it work reliably
we are better off if the records always know to go to the right shard.

It does make the interface a bit more complicated as we need to select
the right shard class with `for(account_id)`.
2025-11-25 11:34:41 +00:00

29 lines
492 B
Ruby

module Card::Searchable
extend ActiveSupport::Concern
included do
include ::Searchable
scope :mentioning, ->(query, user:) do
search_record_class = Search::Record.for(user.account_id)
joins(search_record_class.card_join).merge(search_record_class.for_query(query, user: user))
end
end
def search_title
title
end
def search_content
description.to_plain_text
end
def search_card_id
id
end
def search_board_id
board_id
end
end