Method: Sort::CurrentDirectionForHelper#current_sort_direction_for
- Defined in:
- lib/action_set/helpers/sort/current_direction_for_helper.rb
#current_sort_direction_for(attribute, format: :short) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/action_set/helpers/sort/current_direction_for_helper.rb', line 11 def current_sort_direction_for(attribute, format: :short) direction = current_params.dig(:sort, attribute).to_s.downcase return ascending_str(format) if direction.presence_in %w[asc ascending] return descending_str(format) if direction.presence_in %w[desc descending] direction end |