Module: ElasticRecord::Model::ClassMethods

Defined in:
lib/elastic_record/model.rb

Instance Method Summary collapse

Instance Method Details

#arelasticObject


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

def arelastic
  Arelastic::Builders::Search
end

#elastic_indexObject


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

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

#elastic_index=(index) ⇒ Object


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

def elastic_index=(index)
  @elastic_index = index
end

#inherited(child) ⇒ Object


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

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