Metasearch rails gem multiple time search by field

孤者浪人 提交于 2019-12-13 00:38:27

问题


I have such code of searching (with metasearch rails gem):

@pre_oils = Oil.search({:manufacturer_like => params[:oilbrand], :description_like => params[:oiloiliness], :description_like => params[:oilstructure], :capacity_eq => params[:oilsize]})

But i must to search via description with like on two params: oiloiliness, oilstructure... In some cases i could have first, but didn'r have oilstructure or have oilstructure but didn't have oiloiliness...

if i leave

@pre_oils = Oil.search({:manufacturer_like => params[:oilbrand], :description_like => params[:oiloiliness], :capacity_eq => params[:oilsize]})

all is ok

Now it is not searching via oiloiliness, but why ? How to do it? How to search via both fields?

来源:https://stackoverflow.com/questions/15021826/metasearch-rails-gem-multiple-time-search-by-field

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!