README.md in active_hash_relation-0.0.3 vs README.md in active_hash_relation-1.0.0

- old
+ new

@@ -19,13 +19,13 @@ underneath with the same params. _\*Actually nothing is exposed, but a user could retrieve resources based on unknown attributes (attributes not returned from the API) by brute forcing which might or might not be a security issue. If you don't like that check -[whitelisting](https://github.com/kollegorna/active_hash_relation#whitelisting)._ +[whitelisting](#whitelisting)._ -*New*! You can now do [__aggregation queries__](https://github.com/kollegorna/active_hash_relation#aggregation_queries). +*New*! You can now do [__aggregation queries__](#aggregation-queries). ## Installation Add this line to your application's Gemfile: @@ -147,11 +147,11 @@ ## Aggregation Queries Sometimes we need to ask the database queries that act on the collection but don't want back an array of elements but a value instead! Now you can do that on an ActiveRecord::Relation by simply calling the aggregations method inside the controller: ```ruby -apply_filters(resource, { +aggregations(resource, { aggregate: { integer_column: { avg: true, max: true, min: true, sum: true }, float_column: {avg: true, max: true, min: true }, datetime_column: { max: true, min: true } } @@ -163,10 +163,10 @@ {"float_column"=>{"avg"=>25.5, "max"=>50, "min"=>1}, "integer_column"=>{"avg"=>4.38, "sum"=>219, "max"=>9, "min"=>0}, "datetime_at"=>{"max"=>2015-06-11 20:59:14 UTC, "min"=>2015-06-11 20:59:12 UTC}} ``` -These attributes usually go to the "meta" section of your serializer. In that way it's easy to parse them in the front-end (for ember check [here](http://guides.emberjs.com/v1.10.0/models/handling-metadata/). Please note that you should apply the aggregations __after__ you apply the filters, if there any. +These attributes usually go to the "meta" section of your serializer. In that way it's easy to parse them in the front-end (for ember check [here](http://guides.emberjs.com/v1.10.0/models/handling-metadata/)). Please note that you should apply the aggregations __after__ you apply the filters (if there any) but __before__ you apply pagination! ## Contributing