Module: TheSimpleSortHelper
- Defined in:
- app/helpers/the_simple_sort_helper.rb
Instance Method Summary collapse
Instance Method Details
#simple_sort_url(field, params) ⇒ Object
2 3 4 5 6 7 8 9 10 |
# File 'app/helpers/the_simple_sort_helper.rb', line 2 def simple_sort_url field, params sort_type = :asc if params[:sort_column] == field.to_s sort_type = { desc: :asc, asc: :desc }[ params[:sort_type].to_sym ] end url_for params.merge(sort_column: field, sort_type: sort_type) end |