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+"%")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.