问题
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