Module: Dynamoid::Document
Overview
This is the base module for all domain objects that need to be persisted to the database as documents.
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#new_record ⇒ Object
(also: #new_record?)
Returns the value of attribute new_record.
Attributes included from Attributes
Instance Method Summary collapse
Methods included from Persistence
Methods included from Indexes
#delete_indexes, #key_for_index, #save_indexes
Methods included from Attributes
#read_attribute, #update_attribute, #update_attributes, #write_attribute
Instance Attribute Details
#new_record ⇒ Object Also known as: new_record?
Returns the value of attribute new_record.
10 11 12 |
# File 'lib/dynamoid/document.rb', line 10 def new_record @new_record end |
Instance Method Details
#==(other) ⇒ Object
23 24 25 |
# File 'lib/dynamoid/document.rb', line 23 def ==(other) other.respond_to?(:id) && other.id == self.id end |
#initialize(attrs = {}) ⇒ Object
13 14 15 16 17 |
# File 'lib/dynamoid/document.rb', line 13 def initialize(attrs = {}) @new_record = true @attributes ||= {} self.class.attributes.each {|att| write_attribute(att, attrs[att])} end |
#persisted? ⇒ Boolean
19 20 21 |
# File 'lib/dynamoid/document.rb', line 19 def persisted? !new_record? end |