Reputation: 2085
Im making some filters, and I have a form that searches with multiple params.
I want to search products by :category
and :price
at the same time,
how can I make the query?
Im trying:
@pins = Pin.where('category CONTAINS ?', params[:category] && 'min_price BETWEEN ? AND ?', params[:pin][:min_value], params[:pin][:max_value])
But It won't work!
Upvotes: 0
Views: 544
Reputation: 27789
@pins = Pin.where('category LIKE ? and min_price BETWEEN ? AND ?',
params[:category], params[:pin][:min_value],
params[:pin][:max_value])
Upvotes: 2