Class: Wice::Columns::ConditionsGeneratorColumnRange
- Inherits:
-
ConditionsGeneratorColumn
- Object
- ConditionsGeneratorColumn
- Wice::Columns::ConditionsGeneratorColumnRange
- Defined in:
- lib/wice/columns/column_range.rb
Overview
:nodoc:
Instance Method Summary collapse
Methods inherited from ConditionsGeneratorColumn
Constructor Details
This class inherits a constructor from Wice::Columns::ConditionsGeneratorColumn
Instance Method Details
#generate_conditions(table_alias, opts) ⇒ Object
:nodoc:
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/wice/columns/column_range.rb', line 37 def generate_conditions(table_alias, opts) #:nodoc: unless opts.is_a? Hash Wice.log 'invalid parameters for the grid integer filter - must be a hash' return false end conditions = [[]] if opts[:fr] fr_num = ConditionsGeneratorColumnInteger.get_value(opts[:fr]) if fr_num conditions[0] << " #{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} >= ? " conditions << fr_num else opts.delete(:fr) end end if opts[:to] to_num = ConditionsGeneratorColumnInteger.get_value(opts[:to]) if to_num conditions[0] << " #{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} <= ? " conditions << to_num else opts.delete(:to) end end if conditions.size == 1 return false end conditions[0] = conditions[0].join(' and ') conditions end |