Commit 5d9c266f by liyijie

fix: 修复params判断refs的bug

parent d16c089d
...@@ -286,7 +286,7 @@ class SimpleController::BaseController < ::InheritedResources::Base ...@@ -286,7 +286,7 @@ class SimpleController::BaseController < ::InheritedResources::Base
association = Array(params[:q][:scopes]).reduce(association) { |_association, _scope| _association.send(_scope) } if params[:q][:scopes].present? association = Array(params[:q][:scopes]).reduce(association) { |_association, _scope| _association.send(_scope) } if params[:q][:scopes].present?
association = ransack_association(association, params[:q].except(:scopes, :refs)) association = ransack_association(association, params[:q].except(:scopes, :refs))
end end
if params[:q][:refs].present? if params.dig(:q, :refs).present?
_refs = Array(params[:q][:refs]).map(&:to_sym) _refs = Array(params[:q][:refs]).map(&:to_sym)
association = association.includes(*_refs).joins(*_refs) association = association.includes(*_refs).joins(*_refs)
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