Commit 693ff301 by liyijie

fix: 更新ransack_paginate 逻辑问题

parent 92b60080
...@@ -318,7 +318,7 @@ class SimpleController::BaseController < ::InheritedResources::Base ...@@ -318,7 +318,7 @@ class SimpleController::BaseController < ::InheritedResources::Base
# scopes,代表前端直接调用后台的scope过滤 # scopes,代表前端直接调用后台的scope过滤
association = Array(query_params[:scopes]).reduce(association) { |_association, _scope| _association.send(_scope) } if query_params[:scopes].present? association = Array(query_params[:scopes]).reduce(association) { |_association, _scope| _association.send(_scope) } if query_params[:scopes].present?
if active_record? if active_record?
association.ransack(query_params.except(:scopes, :refs, :jorder)).result association = association.ransack(query_params.except(:scopes, :refs, :jorder)).result
# PG,为了支持distinct和order的操作,需要增加refs,手动includes 和 joins # PG,为了支持distinct和order的操作,需要增加refs,手动includes 和 joins
if query_params[:refs].present? if query_params[:refs].present?
_refs = Array(query_params[:refs]).map(&:to_sym) _refs = Array(query_params[:refs]).map(&:to_sym)
......
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