module ActsAsSorting::Hook
  def acts_as_sorting(*args)
    @acts_as_sorting_options = args.extract_options!
    
    
    def self.qi_table_order
      @acts_as_sorting_options[:fields]
      
    end
  
    def self.valid_sort
      r = []
      self.qi_table_order.each do |key, value|
        if value.instance_of? Hash
          if value[:reorder] == false
          
          elsif value[:reorder] == true
            if value[:sort_name]
              r << value[:sort_name]
            else
              r << key.to_s
            end
          
          end
        end
      end
      return r
    
    
    end
    
    
    
  end
  
  
  
  
end
