Sha256: af8782ef7726ea6e4c05b96af1387b7318d7de218deb715d87b5bad6c61ee2c2

Contents?: true

Size: 739 Bytes

Versions: 7

Compression:

Stored size: 739 Bytes

Contents

# encoding: utf-8
module Wice
  module Columns #:nodoc:
    module CommonRailsDateDatetimeConditionsGeneratorMixin #: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

7 entries across 7 versions & 2 rubygems

Version Path
wice_grid_ms-3.6.2 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
wice_grid_ms-3.6.1 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
wice_grid_ms-3.6.0 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
wice_grid-3.6.0 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
wice_grid-3.6.0.pre5 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
wice_grid-3.6.0.pre4 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
wice_grid-3.6.0.pre3 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb