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:
BrokenEagle
2021-01-06 20:14:28 +00:00
parent 57de81686b
commit db5f9ce243

View File

@@ -329,6 +329,8 @@ module Searchable
relation = relation.where(name => value)
elsif params["#{name}_id"].present?
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
relation