Module: Wice::Columns::CommonJsDateDatetimeConditionsGeneratorMixin
- Included in:
- ConditionsGeneratorColumnBootstrapDatepicker, ConditionsGeneratorColumnHtml5Datepicker, ConditionsGeneratorColumnJqueryDatepicker
- Defined in:
- lib/wice/columns/common_js_date_datetime_conditions_generator_mixin.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#generate_conditions(table_alias, opts) ⇒ Object
:nodoc:
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/wice/columns/common_js_date_datetime_conditions_generator_mixin.rb', line 5 def generate_conditions(table_alias, opts) #:nodoc: datetime = @column_type == :datetime || @column_type == :timestamp conditions = [[]] if opts[:fr] conditions[0] << " #{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} >= ? " date = opts[:fr].to_date if datetime date = date.to_datetime end conditions << date end if opts[:to] op = '<=' date = opts[:to].to_date if datetime date = (date + 1).to_datetime op = '<' end conditions[0] << " #{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} #{op} ? " conditions << date end return false if conditions.size == 1 conditions[0] = conditions[0].join(' and ') conditions end |