Class: ElasticsearchRecord::Base
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ElasticsearchRecord::Base
- Includes:
- Core, ModelSchema, Persistence, Querying
- Defined in:
- lib/elasticsearch_record/base.rb
Instance Method Summary collapse
-
#_create_record(*args) ⇒ Object
included
from Persistence
overwrite to provide a Elasticsearch version: Creates a record with values matching those of the instance attributes and returns its id.
-
#id ⇒ Object
included
from Core
overwrite to provide a Elasticsearch version of returning a 'primary_key' attribute.
-
#id=(value) ⇒ Object
included
from Core
overwrite to provide a Elasticsearch version of setting a 'primary_key' attribute.
-
#id_was ⇒ Object
included
from Core
overwrite to provide a Elasticsearch version of returning a 'primary_key' was attribute.
-
#read_attribute(attr_name, &block) ⇒ Object
included
from Core
overwrite read_attribute method to read from the 'id'-attribute, if present.
-
#undelegate_id_attribute_with(&block) ⇒ Object
included
from Core
resets a possible active
delegate_id_attribute?to false during block execution. -
#write_attribute(attr_name, value) ⇒ Object
included
from Core
overwrite the write_attribute method to always write to the 'id'-attribute, if present.
Instance Method Details
#_create_record(*args) ⇒ Object Originally defined in module Persistence
overwrite to provide a Elasticsearch version: Creates a record with values matching those of the instance attributes and returns its id.
#id ⇒ Object Originally defined in module Core
overwrite to provide a Elasticsearch version of returning a 'primary_key' attribute.
Elasticsearch uses the static _id column as primary_key, but also supports an additional id column.
To provide functionality of returning the id attribute, this method must also support it
with enabled delegate_id_attribute.
#id=(value) ⇒ Object Originally defined in module Core
overwrite to provide a Elasticsearch version of setting a 'primary_key' attribute.
Elasticsearch uses the static _id column as primary_key, but also supports an additional id column.
To provide functionality of setting the id attribute, this method must also support it
with enabled delegate_id_attribute.
#id_was ⇒ Object Originally defined in module Core
overwrite to provide a Elasticsearch version of returning a 'primary_key' was attribute.
Elasticsearch uses the static _id column as primary_key, but also supports an additional id column.
To provide functionality of returning the id_was attribute, this method must also support it
with enabled delegate_id_attribute.
#read_attribute(attr_name, &block) ⇒ Object Originally defined in module Core
overwrite read_attribute method to read from the 'id'-attribute, if present.
This methods does not check for delegate_id_attribute flag!
see @ ActiveRecord::AttributeMethods::Read#read_attribute
#undelegate_id_attribute_with(&block) ⇒ Object Originally defined in module Core
resets a possible active delegate_id_attribute? to false during block execution.
Unfortunately this is required, since a lot of rails-code forces 'accessors' on the primary_key-field through the
+id+-getter & setter methods. This will then fail to set the doc-_id and instead set the +id+-attribute ...
#write_attribute(attr_name, value) ⇒ Object Originally defined in module Core
overwrite the write_attribute method to always write to the 'id'-attribute, if present.
This methods does not check for delegate_id_attribute flag!
see @ ActiveRecord::AttributeMethods::Write#write_attribute