Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 5622daac5e
Fetching contributors…

Cannot retrieve contributors at this time

file 25 lines (22 sloc) 0.739 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
module Searchgasm
  module Condition
    class GreaterThan < Base
      class << self
        def name_for_column(column)
          return unless comparable_column?(column)
          super
        end
        
        def aliases_for_column(column)
          column_names = [column.name]
          column_names << column.name.gsub(/_at$/, "") if [:datetime, :timestamp, :time, :date].include?(column.type) && column.name =~ /_at$/
          
          aliases = []
          column_names.each { |column_name| aliases += ["#{column_name}_gt", "#{column_name}_after"] }
          aliases
        end
      end
      
      def to_conditions(value)
        ["#{quoted_table_name}.#{quoted_column_name} > ?", value]
      end
    end
  end
end
Something went wrong with that request. Please try again.