Sha256: 84d51a77138905812dce66fcffad40ca4fd22fe5f49df22b599bdf8d40d62bf8
Contents?: true
Size: 763 Bytes
Versions: 3
Compression:
Stored size: 763 Bytes
Contents
# encoding: utf-8 module Mongoid #:nodoc module Indexes #:nodoc extend ActiveSupport::Concern included do cattr_accessor :indexed self.indexed = false end module ClassMethods #:nodoc # Add the default indexes to the root document if they do not already # exist. Currently this is only _type. def add_indexes unless indexed self._collection.create_index(:_type, false) self.indexed = true end end # Adds an index on the field specified. Options can be :unique => true or # :unique => false. It will default to the latter. def index(name, options = { :unique => false }) collection.create_index(name, options[:unique]) end end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
mongoid-pre-2.0.0.beta1 | lib/mongoid/indexes.rb |
mongoid-2.0.0.alpha | lib/mongoid/indexes.rb |
mongoid-pre-2.0.0.pre | lib/mongoid/indexes.rb |