Module: EsClient::ActiveRecord::Glue

Extended by:
ActiveSupport::Concern
Defined in:
lib/es_client/active_record/glue.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#as_indexed_jsonObject



36
37
38
# File 'lib/es_client/active_record/glue.rb', line 36

def as_indexed_json
  as_json
end

#es_client_callbacks_enabled?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/es_client/active_record/glue.rb', line 32

def es_client_callbacks_enabled?
  EsClient.callbacks_enabled
end

#es_client_destroyObject



22
23
24
25
# File 'lib/es_client/active_record/glue.rb', line 22

def es_client_destroy
  return if new_record?
  es_client.destroy_document(id)
end

#es_client_document(force = false) ⇒ Object



27
28
29
30
# File 'lib/es_client/active_record/glue.rb', line 27

def es_client_document(force=false)
  return @es_client_document if !force && defined?(@es_client_document)
  @es_client_document = es_client.find(id)
end

#es_client_saveObject



13
14
15
# File 'lib/es_client/active_record/glue.rb', line 13

def es_client_save
  es_client.save_document(self)
end

#es_client_update(additional_doc = nil) ⇒ Object



17
18
19
20
# File 'lib/es_client/active_record/glue.rb', line 17

def es_client_update(additional_doc=nil)
  return if new_record?
  es_client.update_document(self, additional_doc)
end