如何使用 Ruby 和 Searchkick gem 编写此代码。
https://github.com/ankane/searchkick#queries
# Works
@espacos = User.search where: {
gender: params[:gender], # options: :male and :female
other_param: param,
other_param: param
}
# How do search all if the parameter is not informed?
@espacos = User.search where: {
if not nil params[:gender]
gender: params[:gender],
end
other_param: param,
other_param: param
}