Module: Dynamoid::Indexes::ClassMethods

Defined in:
lib/dynamoid/indexes.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) create_indexes



27
28
29
30
31
32
# File 'lib/dynamoid/indexes.rb', line 27

def create_indexes
  self.indexes.each do |name, index|
    opts = index.range_key? ? {:range_key => :range} : {}
    self.create_table(index.table_name, :id, opts) unless self.table_exists?(index.table_name)
  end
end

- (Object) find_index(index)



23
24
25
# File 'lib/dynamoid/indexes.rb', line 23

def find_index(index)
  self.indexes[Array(index).collect(&:to_s).sort.collect(&:to_sym)]
end

- (Object) index(name, options = {})



17
18
19
20
21
# File 'lib/dynamoid/indexes.rb', line 17

def index(name, options = {})
  index = Dynamoid::Indexes::Index.new(self, name, options)
  self.indexes[index.name] = index
  create_indexes        
end