Module: ElasticRecord::Model::ClassMethods

Defined in:
lib/elastic_record/model.rb

Instance Method Summary collapse

Instance Method Details

#arelasticObject



26
27
28
# File 'lib/elastic_record/model.rb', line 26

def arelastic
  Arelastic::Builders::Search
end

#elastic_indexObject



30
31
32
# File 'lib/elastic_record/model.rb', line 30

def elastic_index
  @elastic_index ||= ElasticRecord::Index.new(self)
end

#elastic_index=(index) ⇒ Object



34
35
36
# File 'lib/elastic_record/model.rb', line 34

def elastic_index=(index)
  @elastic_index = index
end

#inherited(child) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/elastic_record/model.rb', line 16

def inherited(child)
  super

  if child < child.base_class
    child.elastic_index = elastic_index.dup
    child.elastic_index.model = child
    child.elastic_index.mapping_type = elastic_index.mapping_type
  end
end