我有搜索(与元搜索轨宝石)的这样的代码:
@pre_oils = Oil.search({:manufacturer_like => params[:oilbrand], :description_like => params[:oiloiliness], :description_like => params[:oilstructure], :capacity_eq => params[:oilsize]})
但我必须通过描述,就像要搜索的两个参数:oiloiliness,oilstructure ......在某些情况下,我能有第一次,但didn'r有oilstructure或有oilstructure但没有oiloiliness ...
如果我离开
@pre_oils = Oil.search({:manufacturer_like => params[:oilbrand], :description_like => params[:oiloiliness], :capacity_eq => params[:oilsize]})
一切正常
现在,它不是通过搜索oiloiliness,但是为什么呢? 怎么做? 如何通过这两个字段进行搜索?