1
我怎樣才能在Rails中實現這樣的條件(如果有一種方法)與哈希參數,而不寫在那裏字符串:或者在方法的ActiveRecord
Model.where(**:launched => nil or false**, :verify => false, :pools => {:status => 'later'})
我怎樣才能在Rails中實現這樣的條件(如果有一種方法)與哈希參數,而不寫在那裏字符串:或者在方法的ActiveRecord
Model.where(**:launched => nil or false**, :verify => false, :pools => {:status => 'later'})
Model.where(:launched => [nil, false], :verify => false, :pools => {:status => 'later'})
現在你將查詢所有對象,其中:啓動是無或錯。
P.s.拋棄散列火箭並使用更清晰的Ruby 1.9+語法,除非你想堅持使用Ruby 1.8.7或更早的版本。例如:Model.where(推出:[nil,false])
Rials => rails請在您的帖子上進行http://stackoverflow.com/questions/3548548/rails3-combine-scope-with-or –