Module: MongoODM::Document::Indexes::ClassMethods

Defined in:
lib/mongo_odm/document/indexes.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) create_indexes



45
46
47
# File 'lib/mongo_odm/document/indexes.rb', line 45

def create_indexes
  indexes.each {|index| create_index index.spec, index.opts }
end

- (Object) index(spec, opts = {})



38
39
40
41
42
43
# File 'lib/mongo_odm/document/indexes.rb', line 38

def index(spec, opts = {})
  new_index = Index.new(spec, opts)
  indexes << new_index
  MongoODM.add_index_class(self)
  new_index
end

- (Object) indexes



34
35
36
# File 'lib/mongo_odm/document/indexes.rb', line 34

def indexes
  @indexes ||= []
end

- (Object) inherited(subclass)



29
30
31
32
# File 'lib/mongo_odm/document/indexes.rb', line 29

def inherited(subclass)
  super
  indexes.concat(subclass.indexes)
end