activerecord-hackery--ransack/lib/ransack/helpers
Caleb Land bd22760223 Add multiple sort field support in sort_link
This patch allows users to sort on multiple fields with the sort_link
helper.

To specify sorting on multiple fields:

  sort_link(:kind, [:kind, 'name asc'])

This will create a sort link that sorts first by kind, and then by
name. The first `:kind` parameter ensures that the link generated
shows the sort status of the `kind` field.

When you specify a sort direction in the sort fields array, the
direction is locked to that direction. In the above example, clicking
the resulting link would toggle sorting of the kind field, but the name
field would always sort ascending.

Also added was the ability to specify multiple default_order fields
with a hash:

  sort_link(:kind, [:kind, :name],
            :default_order => { :name => 'asc', :kind => 'desc' })

Clicking the resulting link will toggle the sort directions of both
`name` and `kind`, sorting the `name` field by default ascending, and
the `kind` field descending.
2014-10-02 00:54:12 -04:00
..
form_builder.rb Maintain Ruby 1.8.7 syntax compatibility 2014-05-01 15:55:39 +02:00
form_helper.rb Add multiple sort field support in sort_link 2014-10-02 00:54:12 -04:00