app/controllers/apicasso/crud_controller.rb in apicasso-0.2.7 vs app/controllers/apicasso/crud_controller.rb in apicasso-0.2.8

- old
+ new

@@ -145,11 +145,11 @@ # The response for index action, which can be a pagination of a record collection # or a grouped count of attributes def index_json if params[:group].present? - accessible_records.group(params[:group].split(',')).count + accessible_records.group(params[:group][:by].split(',')).send(params[:group][:calculate], params[:group][:fields]) else collection_response end end @@ -168,10 +168,10 @@ JSON.parse(paginated_records.to_json(include: parsed_include)) end # Returns the collection checking if it needs pagination def collection_response - if params[:per_page].to_i == -1 + if params[:per_page].to_i < 0 built_unpaginated else built_paginated end end