Using searchkick gem how would I translate this to the .search way? Or is it not doable?
@projects = Project.joins(:proj_status)
Just wasn't sure how to do joins.
Using searchkick gem how would I translate this to the .search way? Or is it not doable?
@projects = Project.joins(:proj_status)
Just wasn't sure how to do joins.
If you want to search for projects with status then you might need to do in the following way
in your project model where searchkick included try this
this is for indexing data I assume Project has name and id and its associated model proj_status has a title.You may change the values depend on your model attributes
def search_data
id: id,
name: name,
status: proj_status.title
end
After Project.reindex
Then you can query Project model with status like,
@projects = Product.search "you query if any", includes: [:proj_status], where: {status: 'open'}
eager loading example from gem reference
for your code above