def filterrific_sorting_link(filterrific, sort_key, opts = {})
      opts = {
        :active_column_class => 'filterrific_current_sort_column',
        :inactive_column_class => 'filterrific_sort_column',
        :ascending_indicator => '⬆',
        :default_sort_direction => 'asc',
        :descending_indicator => '⬇',
        :html_attrs => {},
        :label => sort_key.to_s.humanize,
        :sorting_scope_name => :sorted_by,
        :url_for_attrs => {},
      }.merge(opts)
      opts.merge!(
        :html_attrs => opts[:html_attrs].with_indifferent_access,
        :current_sorting => (current_sorting = filterrific.send(opts[:sorting_scope_name])),
        :current_sort_key => current_sorting ? current_sorting.gsub(/_asc|_desc/, '') : nil,
        :current_sort_direction => current_sorting ? (current_sorting =~ /_desc\z/ ? 'desc' : 'asc') : nil,
        :current_sort_direction_indicator => (current_sorting =~ /_desc\z/ ? opts[:descending_indicator] : opts[:ascending_indicator]),
      )
      new_sort_key = sort_key.to_s
      if new_sort_key == opts[:current_sort_key]
        # same sort column, reverse order
        filterrific_sorting_link_reverse_order(filterrific, new_sort_key, opts)
      else
        # new sort column, default sort order
        filterrific_sorting_link_new_column(filterrific, new_sort_key, opts)
      end
    end
def filterrific_sorting_link(filterrific, sort_key, opts = {})
      opts = {
        :active_column_class => 'filterrific_current_sort_column',
        :inactive_column_class => 'filterrific_sort_column',
        :ascending_indicator => '⬆',
        :default_sort_direction => 'asc',
        :descending_indicator => '⬇',
        :html_attrs => {},
        :label => sort_key.to_s.humanize,
        :sorting_scope_name => :sorted_by,
        :url_for_attrs => {},
      }.merge(opts)
      opts.merge!(
        :html_attrs => opts[:html_attrs].with_indifferent_access,
        :current_sorting => (current_sorting = filterrific.send(opts[:sorting_scope_name])),
        :current_sort_key => current_sorting ? current_sorting.gsub(/_asc|_desc/, '') : nil,
        :current_sort_direction => current_sorting ? (current_sorting =~ /_desc\z/ ? 'desc' : 'asc') : nil,
        :current_sort_direction_indicator => (current_sorting =~ /_desc\z/ ? opts[:descending_indicator] : opts[:ascending_indicator]),
      )
      new_sort_key = sort_key.to_s
      if new_sort_key == opts[:current_sort_key]
        # same sort column, reverse order
        filterrific_sorting_link_reverse_order(filterrific, new_sort_key, opts)
      else
        # new sort column, default sort order
        filterrific_sorting_link_new_column(filterrific, new_sort_key, opts)
      end
    end
Renders a link which indicates the current sorting and which can be used to
 toggle the list sorting (set column and direction).

 NOTE: Make sure that this is used in the list partial that is re-rendered
 when the filterrific params are changed, so that the filterrific params in
 the URL are always current.

 NOTE: Currently the filterrific_sorting_link is not synchronized with a
 SELECT input you may have in the filter form for sorting. We recommend you
 use one or the other to avoid conflicting sort settings in the UI.

 @param filterrific [Filterrific::ParamSet] the current filterrific instance
 @param sort_key [String, Symbol] the key to sort by, without direction.
     Example: 'name', 'created_at'
 @param opts [Hash, optional]
 @options opts [String, optional] active_column_class
     CSS class applied to current sort column. Default: 'filterrific_current_sort_column'
 @options opts [String, optional] ascending_indicator
     HTML string to indicate ascending sort direction. Default: '⬆'
 @options opts [String, optional] default_sort_direction
     Override the default sorting when selecting a new sort column. Default: 'asc'.
 @options opts [String, optional] descending_indicator
     HTML string to indicate descending sort direction. Default: '⬇'
 @options opts [Hash, optional] html_attrs
     HTML attributes to be added to the sorting link. Default: {}
 @options opts [String, optional] label
     Override label. Default: `sort_key.to_s.humanize`.
 @options opts [String, Symbol, optional] sorting_scope_name
     Override the name of the scope used for sorting. Default: :sorted_by
 @options opts [Hash, optional] url_for_attrs
     Override the target URL attributes to be used for `url_for`. Default: {} (current URL).