2013-07-24 37 views
1

我試圖檢查與輪胎,如果一個字段爲空。 這是我對我的模型的查詢。我如何檢查一個字段是否爲空或輪胎上的輪胎寶石爲空

def self.search(params) 
    tire.search(load: true, match_all: {}, page: params[:page], per_page: 12) do 
    query do 
     boolean do 
     must { string params[:query], default_operator: "AND" } 
     must { term :online, true } 
     must_not { string 'name:Undefined' } 
     must_not { term 'price:null' } 
     end 
    end 
    end 
end 

must_not { term 'price:null' } is the code wich leads me to an error. 

我該怎麼辦? 感謝

回答

0

使用

must_not { |m| m.term "price", nil } 
+0

對不起,不能正常工作。 –

相關問題