Commit c3b0c42a by liyijie

feat: 支持mongoid ransack搜索

parent 65e80524
......@@ -328,8 +328,11 @@ class SimpleController::BaseController < ::InheritedResources::Base
if active_record?
association.ransack(query_params).result
else
selector = RansackMongo::Query.parse(query_params)
association.where(selector)
_params = query_params.clone
order_params = _params.delete(:s)
selector = RansackMongo::Query.parse(_params)
order_params.present? ?
association.where(selector).order(*Array(order_params)) : association.where(selector)
end
end
end
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