meilisearch-rails icon indicating copy to clipboard operation
meilisearch-rails copied to clipboard

Add a scope parameter to eager load matched records

Open DavertMik opened this issue 2 years ago • 1 comments

Description It would be nice if this gem could to eager load relations of matched records

class Book
  scope with_author: -> { includes(:author) }
end

Book.search('Harry Potter', scope: :with_author)

I would add an optional scope parameter and used it here to load relations https://github.com/meilisearch/meilisearch-rails/blob/main/lib/meilisearch-rails.rb#L653

DavertMik avatar Jan 10 '23 02:01 DavertMik