Sha256: ec8f51ba189e7959a92ce22dd6e8b21447f10be857314697ff35e370fd93ea58

Contents?: true

Size: 736 Bytes

Versions: 2

Compression:

Stored size: 736 Bytes

Contents

# encoding: utf-8
module Wice
  module Columns #:nodoc:
    module CommonJsDateDatetimeConditionsGeneratorMixin #:nodoc:

      def generate_conditions(table_alias, opts)   #:nodoc:
        conditions = [[]]
        if opts[:fr]
          conditions[0] << " #{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} >= ? "
          conditions << opts[:fr].to_date
        end

        if opts[:to]
          conditions[0] << " #{@column_wrapper.alias_or_table_name(table_alias)}.#{@column_wrapper.name} <= ? "
          conditions << (opts[:to].to_date + 1)
        end

        return false if conditions.size == 1

        conditions[0] = conditions[0].join(' and ')
        conditions
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wice_grid-3.6.0.pre2 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
wice_grid-3.6.0.pre1 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb