pg_search
pg_search copied to clipboard
Nested model search + ActionText
Hi! I have several models - Post
class Post
has_many :comments
has_rich_text :body
pg_search_scope :search,
against: %i[title],
associated_against: {
rich_text_body: [:body],
comments: {rich_text_body: [:body]}
},
using: {tsearch: {any_word: true}}
end
and Comment
class Comment
belongs_to :post
has_rich_text :body
end
I'd like to perform a search in all threads, to find all posts and comments which contain a search string. With following configuration i can search in posts (but i need to remove comments: {rich_text_body: [:body]}), so how can i configure pg_search_scope to perform search in comments?