Support multiple excludes for enum types
It's not possible to pass it off to search_numeric_attribute directly since the column "category" does not match the prefix "category_id".
This commit is contained in:
@@ -329,6 +329,8 @@ module Searchable
|
|||||||
relation = relation.where(name => value)
|
relation = relation.where(name => value)
|
||||||
elsif params["#{name}_id"].present?
|
elsif params["#{name}_id"].present?
|
||||||
relation = relation.numeric_attribute_matches(name, params["#{name}_id"])
|
relation = relation.numeric_attribute_matches(name, params["#{name}_id"])
|
||||||
|
elsif params["#{name}_id_not"].present?
|
||||||
|
relation = relation.where.not(id: relation.numeric_attribute_matches(name, params["#{name}_id_not"]))
|
||||||
end
|
end
|
||||||
|
|
||||||
relation
|
relation
|
||||||
|
|||||||
Reference in New Issue
Block a user