implement condition negation manually, since removed from arel 2

This commit is contained in:
Emi Matchu 2010-11-17 00:30:17 -05:00
parent f2c98c7697
commit d33723aa84

View file

@ -262,7 +262,7 @@ class Item < ActiveRecord::Base
SearchFilterScopes << name.to_s SearchFilterScopes << name.to_s
scope "search_filter_#{name}", lambda { |str, negative| scope "search_filter_#{name}", lambda { |str, negative|
condition = yield(str) condition = yield(str)
condition = not(condition) if negative condition = "!(#{condition.to_sql})" if negative
rel = where(condition) rel = where(condition)
rel = rel & args[:scope] if args[:scope] rel = rel & args[:scope] if args[:scope]
rel rel