cerebris/jsonapi-resources — pull request #30 by whatthewhat (2014-10-15 17:49:23+00:00)
Title: Sorting

http://jsonapi.org/format/#fetching-sorting

Hi, thanks for the awesome gem!

I've tried to implement basic resource sorting (`GET /people?sort=age,name`, not `GET /posts?include=author&sort[posts]=-created,title&sort[people]=name`)

The easies way to implement sorting was to shoehorn it into the `.find` method, which is what I did.
The downside is that `.find`'s signature has changed.

What I would really like to do is something like this:

```ruby
def index
render json: JSONAPI::ResourceSerializer.new.serialize_to_hash(
resource_klass
.find(@request.filters)
.sort(@request.sort_params)
#...
```

But that would be a pretty big refactoring..

Anyway, will appreciate any feedback.