Sha256: bc73948b9e3790bc84cef19496ba8fb37a9ab0cdf2091cac4c36801f5aa3cfbf

Contents?: true

Size: 721 Bytes

Versions: 18

Compression:

Stored size: 721 Bytes

Contents

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

18 entries across 18 versions & 2 rubygems

Version Path
wice_grid-7.1.4 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
wice_grid-7.1.3 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
wice_grid-7.1.2 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
wice_grid-7.1.1 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
wice_grid-7.1.0 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
wice_grid-6.1.3 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
wice_grid-6.1.2 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
wice_grid-6.1.1 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
wice_grid-6.1.0 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
pwice_grid-7.0.0 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
pwice_grid-6.1.2 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
pwice_grid-6.1.1 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
pwice_grid-6.1.0 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
pwice_grid-5.0.2 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
pwice_grid-5.0.1 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
pwice_grid-5.0.0 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
wice_grid-4.1.0 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb
wice_grid-3.6.2 lib/wice/columns/common_rails_date_datetime_conditions_generator_mixin.rb