def apply_sort(records)
      return records unless params[:sort].present?

      if records.is_a?(Array)
        records.sort { |a, b| comp = 0; eval(sort_criteria) }
      elsif records.respond_to?(:order)
        records.order(sort_params)
      end
    end
def apply_sort(records)
      return records unless params[:sort].present?

      if records.is_a?(Array)
        records.sort { |a, b| comp = 0; eval(sort_criteria) }
      elsif records.respond_to?(:order)
        records.order(sort_params)
      end
    end
Apply sort on result set (ascending by default).
   e.g.: User.order(:first_name)

 @param records [ActiveRecord::Relation, Array] collection of records
   e.g.: User.all or [{ id: 1, name: 'Tiago' }, { id: 2, name: 'Doug' }]

 @return [ActiveRecord::Relation, Array]

 @api public