Sha256: c0841b7dde3b02e93094e944e33f53604b4262a5a8c761ab61d765fa7219c897

Contents?: true

Size: 534 Bytes

Versions: 1

Compression:

Stored size: 534 Bytes

Contents

module Searchgasm
  module Condition
    class Nil < Base
      self.type_cast_sql_type = "boolean"
      
      class << self
        def aliases_for_column(column)
          ["#{column.name}_is_nil", "#{column.name}_is_null", "#{column.name}_null"]
        end
      end
      
      def to_conditions(value)
        if value == true
          "#{quoted_table_name}.#{quoted_column_name} is NULL"
        elsif value == false
          "#{quoted_table_name}.#{quoted_column_name} is NOT NULL"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
searchgasm-1.2.2 lib/searchgasm/condition/nil.rb