Having a single method that is invoked for every sort comparison that does the config settings is probably better written with a different lambda/method for each search, and choose the lambda based on the sort in a different method:

    sort = if @active_sort == 'total'
      if @active_sort_direction == 'desc'
        lambda{ |s| -s[:dist_avail_capacity] }
      else
        lambda{ |s| s[:dist_avail_capacity] }
      end
    else

This makes it much clearer to read.