f3ndot/doorprize — pull request #20 by f3ndot (2013-08-12 21:09:04+00:00)
Title: Sort Incidents by severity, recency, and date of incident with pagination

Takes care of #2

Offers 6 sorts by way of scopes on the `Incident` model:

```ruby
scope :latest_incidents, -> { order 'datetime_of_incident DESC' }
scope :oldest_incidents, -> { order 'datetime_of_incident ASC' }
scope :latest_submitted, -> { order 'created_at DESC' }
scope :oldest_submitted, -> { order 'created_at ASC' }
scope :most_severe, -> { order 'severity DESC' }
scope :least_severe, -> { order 'severity ASC' }
```

Pagination by using the [`kaminari`](https://github.com/amatsuda/kaminari) gem, because I've had trouble with `will_paginate` in the past.

Sorting available to user via a dropdown button on the top-right of the table listing:

![screen shot 2013-08-12 at 5 08 20 pm](https://f.cloud.github.com/assets/740289/950685/68c89914-0393-11e3-9abd-7fe461cc6007.png)