Module: ElasticRecord::Model::ClassMethods

Defined in:
lib/elastic_record/model.rb

Instance Method Summary collapse

Instance Method Details

#arelasticObject



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

def arelastic
  Arelastic::Builders::Search
end

#elastic_indexObject



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

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

#elastic_index=(index) ⇒ Object



37
38
39
# File 'lib/elastic_record/model.rb', line 37

def elastic_index=(index)
  @elastic_index = index
end

#inherited(child) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/elastic_record/model.rb', line 19

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