Sha256: 62b24d67f0941c5a46f61153cdebc3fe2264f51a743d79c9c57f92e0f1528b1a

Contents?: true

Size: 537 Bytes

Versions: 2

Compression:

Stored size: 537 Bytes

Contents

module Searchgasm
  module Condition
    class Blank < Base
      self.value_type = :boolean
      
      class << self
        def condition_names_for_column
          super + ["is_blank"]
        end
      end
      
      def to_conditions(value)
        # Some databases handle null values differently, let AR handle this
        if value == true
          "#{column_sql} is NULL or #{column_sql} = ''"
        elsif value == false
          "#{column_sql} is NOT NULL and #{column_sql} != ''"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
searchgasm-1.3.1 lib/searchgasm/condition/blank.rb
searchgasm-1.3.0 lib/searchgasm/condition/blank.rb