Reputation: 720
how can I implement "contains function" in active records? I am trying to query my database which contains the following data as an example
brand: ipad model : ipad 3gen specs : wifi+3g 32 GB black
when the user searched for "ipad black 3gen" he should get the above record.
this is my trail which didnt work
@products = Product.where("brand like ? OR generation like ? OR spec_overview like ? ", "%"+params[:query].capitalize+"%", "%"+params[:query].capitalize+"%", "%"+params[:query].capitalize+"%")
Upvotes: 0
Views: 633