def apply_search_to model
      if options[:search]
        if options[:new_search]
          options[:page] = 1
          options.delete(:new_search)
        end

        column_hash = model.columns_hash || model.class.columns_hash

        if column_hash[options[:search][:column].to_s].sql_type.include?('char')
          model.where(model.arel_table[options[:search][:column]].matches("%#{options[:search][:query]}%"))
        else
          model.where(options[:search][:column].to_sym => options[:search][:query])
        end
      else
        model
      end
    end
def apply_search_to model
      if options[:search]
        if options[:new_search]
          options[:page] = 1
          options.delete(:new_search)
        end

        column_hash = model.columns_hash || model.class.columns_hash

        if column_hash[options[:search][:column].to_s].sql_type.include?('char')
          model.where(model.arel_table[options[:search][:column]].matches("%#{options[:search][:query]}%"))
        else
          model.where(options[:search][:column].to_sym => options[:search][:query])
        end
      else
        model
      end
    end
Apply the search query to the appropriate table columns. This is sort of ugly at the moment
 and not as reliable as it could be. It needs to be refactored to account for different column
 types and use appropriate search methods. Ex. LIKE doesn't work for integers
 TODO refactor this to be more reliable for all column types