Answer the question
In order to leave comments, you need to log in
RoR 4, Elasticsearch and searchkick. How to do a conditional search?
Hello.
To search in the project, I use Elasticsearch and the searchkick gem.
What is the correct way to use the where method? It is necessary that from the User table the search and output of results be with the condition, the field sex = 'male'.
Controller
if params[:query].present?
query = params[:query]
@user_array = User.search(query)
- @user_array.each do |user|
...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question