Reputation: 2085
I'm trying to make some filters work, but I don't know why is it breaking.
I'm trying to filter my Pins table in the :min_price
column:
In the controller action, I do:
@pins = Pin.where(min_price: 'BETWEEN' params[:pin][:min_value] 'AND' params[:pin][:max_value])
I don't know how to make this statement with no sintax errors. Any help?
Thanks!
Upvotes: 1
Views: 16
Reputation: 4386
Try to use plain SQL
@pins = Pin.where('min_price BETWEEN ? AND ?', params[:pin][:min_value], params[:pin][:max_value])
Upvotes: 2