Method: Mongoid::Indexable::ClassMethods#index
- Defined in:
- lib/mongoid/indexable.rb
#index(spec, options = nil) ⇒ Hash
Adds an index definition for the provided single or compound keys.
99 100 101 102 103 104 |
# File 'lib/mongoid/indexable.rb', line 99 def index(spec, = nil) specification = Specification.new(self, spec, ) if !index_specifications.include?(specification) index_specifications.push(specification) end end |