Class: Wice::FilterConditionsGeneratorInteger
- Inherits:
-
FilterConditionsGenerator
- Object
- FilterConditionsGenerator
- Wice::FilterConditionsGeneratorInteger
- Defined in:
- lib/wice_grid.rb
Overview
:nodoc:
Instance Method Summary collapse
Methods inherited from FilterConditionsGenerator
Constructor Details
This class inherits a constructor from Wice::FilterConditionsGenerator
Instance Method Details
#generate_conditions(table_alias, opts) ⇒ Object
:nodoc:
782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 |
# File 'lib/wice_grid.rb', line 782 def generate_conditions(table_alias, opts) #:nodoc: unless opts.kind_of? Hash Wice.log "invalid parameters for the grid integer filter - must be a hash" return false end conditions = [[]] if opts[:fr] if opts[:fr] =~ /\d/ conditions[0] << " #{@column.alias_or_table_name(table_alias)}.#{@column.name} >= ? " conditions << opts[:fr] else opts.delete(:fr) end end if opts[:to] if opts[:to] =~ /\d/ conditions[0] << " #{@column.alias_or_table_name(table_alias)}.#{@column.name} <= ? " conditions << opts[:to] else opts.delete(:to) end end if conditions.size == 1 return false end conditions[0] = conditions[0].join(' and ') return conditions end |