Class: Wice::Columns::ConditionsGeneratorColumnBoolean

Inherits:
ConditionsGeneratorColumn show all
Defined in:
lib/wice/columns/column_boolean.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from ConditionsGeneratorColumn

#initialize

Constructor Details

This class inherits a constructor from Wice::Columns::ConditionsGeneratorColumn

Instance Method Details

#generate_conditions(table_alias, opts) ⇒ Object

:nodoc:



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/wice/columns/column_boolean.rb', line 25

def  generate_conditions(table_alias, opts)   #:nodoc:
  unless opts.is_a?(Array) && opts.size == 1
    Wice.log "invalid parameters for the grid boolean filter - must be an one item array: #{opts.inspect}"
    return false
  end
  opts = opts[0]
  if opts == 'f'
    [" (#{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} = ? or #{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} is null) ", false]
  elsif opts == 't'
    [" #{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} = ?", true]
          end
end