Commit ffed7648 by liyijie

use statistics instead of statistic

parent a49fd635
json.current_page @<%= resource_plural %>.current_page
json.total_pages @<%= resource_plural %>.total_pages
json.total_count @<%= resource_plural %>.count
json.statistic @statistic if @statistic.present?
json.statistics @statistics if @statistics.present?
json.records @<%= resource_plural %>, partial: '<%= view_path %>/simple', as: :<%= resource_singular %>
......@@ -176,8 +176,8 @@ class SimpleController::BaseController < ::InheritedResources::Base
# 执行sub_q
def ransack_paginate(association)
if params[:group_keys].present?
statistic_association = association.unscope(:order).distinct
@statistic = statistic_association.group(params[:group_keys]).count.merge(count: statistic_association.count)
statistics_association = association.unscope(:order).distinct
@statistics = statistics_association.group(params[:group_keys]).count.merge(count: statistics_association.count)
end
association = association.ransack(params[:sub_q]).result unless self.class.instance_variable_get(:@ransack_off) || params[:sub_q].blank?
......
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