我在這裏做錯了什麼?有條件幫助
features = WidgetFeature.all(:conditions => {:widget_id=>params[:id], :children_features=>nil, :filterable => true" })
我想找到所有這些功能,其中WIDGET_ID =參數[:ID]和children_features爲零和過濾是真實
我在這裏做錯了什麼?有條件幫助
features = WidgetFeature.all(:conditions => {:widget_id=>params[:id], :children_features=>nil, :filterable => true" })
我想找到所有這些功能,其中WIDGET_ID =參數[:ID]和children_features爲零和過濾是真實
features = WidgetFeature.all(:conditions => {:widget_id=>params[:id], :children_features=>nil, :filterable => true })
這工作。我解決了它。
試試這個:
features = WidgetFeature.find(:all, :conditions => "[widget_id=? and children_features is NULL and filterable = true", params[:id] ]")
這將幫助你..
在我的感覺這樣做的最好辦法是
WidgetFeature.some_name_for_named_scope(PARAMS [:編號])
IN WidgetFeature Model
named_scope:some _name_for_named_scope,lambda {| widget_id | {:條件=> [ 「WIDGET_ID = AND children_features = AND過濾=???」,WIDGET_ID,零,真]}}
請讓我知道你或任何人想的?
你的意思是在你的條件散列末尾有雙引號嗎? – 2010-07-12 09:29:48
@John: - 我解決了它。 – 2010-07-12 09:40:52