Sha256: 167f61eda6a65caffde83f2f4a24c0fe140c7460857caafee8670c33e4c43079
Contents?: true
Size: 1.02 KB
Versions: 6
Compression:
Stored size: 1.02 KB
Contents
# encoding: utf-8 module Wice module Columns #:nodoc: module CommonJsDateDatetimeConditionsGeneratorMixin #:nodoc: 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 end end end
Version data entries
6 entries across 6 versions & 1 rubygems