Module: ElasticsearchRecord::Core::ClassMethods

Includes:
PrependClassMethods
Defined in:
lib/elasticsearch_record/core.rb

Instance Method Summary collapse

Instance Method Details

#apianonymous Struct

used to provide fast access to the connection API without explicit providing table-related parameters.

Returns:

  • (anonymous Struct)


106
107
108
# File 'lib/elasticsearch_record/core.rb', line 106

def api
  ElasticsearchRecord::ModelApi.new(self)
end

#cached_find_by_statement(key, &block) ⇒ Object

used to create a cacheable statement. This is a 1:1 copy, except that we use our own class +ElasticsearchRecord::StatementCache+ see @ ActiveRecord::Core::ClassMethods#cached_find_by_statement



99
100
101
102
# File 'lib/elasticsearch_record/core.rb', line 99

def cached_find_by_statement(key, &block)
  cache = @find_by_statement_cache[connection.prepared_statements]
  cache.compute_if_absent(key) { ElasticsearchRecord::StatementCache.create(connection, &block) }
end

#index_nameObject Originally defined in module PrependClassMethods

returns the table_name. Has to be prepended to provide automated compatibility to other gems.