Commit 1993313e by liyijie

feat: 支持cont_any的设置

parent 1700a25f
module RansackMongo
class MongoAdapter
PREDICATES = %w[null not_null eq not_eq cont in start mstart gt lt gteq lteq]
PREDICATES = %w[null not_null eq not_eq cont cont_any in start mstart gt lt gteq lteq]
def initialize
@query = {}
......@@ -26,6 +26,11 @@ module RansackMongo
@query[attr] = { '$ne' => value }
end
def cont_any_matcher(attr, value_arr)
value = Array(value_arr).join('|')
cont_matcher(attr, value)
end
def cont_matcher(attr, value)
@query[attr] = /#{value}/i
end
......
......@@ -5,7 +5,6 @@ module RansackMongo
end
def parse(params)
binding.pry
(params || {}).keys.inject({}) do |query, query_param|
attr = query_param.to_s
p, attr = detect_and_strip_from_string(attr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment