Sha256: 3b6c903acdbb64b2c14d1cfc82f1ca6a051aa45e301f1dd5dbb5adb351bd83a7

Contents?: true

Size: 662 Bytes

Versions: 2

Compression:

Stored size: 662 Bytes

Contents

module Workarea
  module Api
    module Admin
      module DateIndexes
        extend self

        # We do this separately from the DateFiltering module to ensure
        # this happens after a model has defined all of its normal indexes. This
        # prevents the date filtering indexes from applying before explicity
        # defined indexes for models that could include options like a TTL.
        def load
          ::Mongoid.models.each do |model|
            if model < ApplicationDocument
              model.index({ updated_at: 1 })
              model.index({ created_at: 1 })
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
workarea-api-4.5.6 admin/lib/workarea/api/admin/date_indexes.rb
workarea-api-admin-4.5.6 lib/workarea/api/admin/date_indexes.rb