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

#doctypeObject



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

def doctype
  @doctype ||= Doctype.new(base_class.name.demodulize.underscore)
end

#doctype=(new_doctype) ⇒ Object



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

def doctype=(new_doctype)
  @doctype = new_doctype
end

#elastic_indexObject



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

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

#elastic_index=(index) ⇒ Object



42
43
44
# File 'lib/elastic_record/model.rb', line 42

def elastic_index=(index)
  @elastic_index = index
end

#inherited(child) ⇒ Object



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

def inherited(child)
  super

  if child < child.base_class
    child.elastic_index = elastic_index.dup
    child.doctype = doctype.dup
  end
end