def index_json
      if params[:group].present?
        @records.group(params[:group][:by].split(','))
                .send(:calculate,
                      params[:group][:calculate],
                      params[:group][:field])
      else
        collection_response
      end
    end
def index_json
      if params[:group].present?
        @records.group(params[:group][:by].split(','))
                .send(:calculate,
                      params[:group][:calculate],
                      params[:group][:field])
      else
        collection_response
      end
    end
The response for index action, which can be a pagination of a
 record collection or a grouped count of attributes