module Sort::CurrentDirectionForHelper
Public Instance Methods
current_sort_direction_for(attribute, format: :short)
click to toggle source
# 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