Commit 7d7b1507 by liyijie

feat: 兼容ransack_paginate搜索q参数

parent c61bdfc6
......@@ -184,6 +184,7 @@ class SimpleController::BaseController < ::InheritedResources::Base
@statistics = statistics_association.group(params[:group_keys]).count.merge(count: statistics_association.count)
end
association = association.ransack(params[:q]).result unless self.class.instance_variable_get(:@ransack_off) || params[:q].blank?
association = association.ransack(params[:sub_q]).result unless self.class.instance_variable_get(:@ransack_off) || params[:sub_q].blank?
association = association.distinct unless self.class.instance_variable_get(:@distinct_off) || !association.respond_to?(:distinct)
association = association.paginate(page: params[:page], per_page: params[:per_page]) unless self.class.instance_variable_get(:@paginate_off)
......
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