Module: ElasticsearchRecord::Core::ClassMethods
- Includes:
- PrependClassMethods
- Defined in:
- lib/elasticsearch_record/core.rb
Instance Method Summary collapse
-
#api ⇒ anonymous Struct
used to provide fast access to the connection API without explicit providing table-related parameters.
-
#cached_find_by_statement(key, &block) ⇒ Object
used to create a cacheable statement.
-
#index_name ⇒ Object
included
from PrependClassMethods
returns the table_name.
Instance Method Details
#api ⇒ anonymous Struct
used to provide fast access to the connection API without explicit providing table-related parameters.
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_name ⇒ Object Originally defined in module PrependClassMethods
returns the table_name. Has to be prepended to provide automated compatibility to other gems.