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: #persisted?, #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
Methods included from Attributes
#read_attribute, #update_attribute, #update_attributes, #write_attribute
Instance Attribute Details
#new_record ⇒ Object Also known as: persisted?, 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
20 21 22 |
# File 'lib/dynamoid/document.rb', line 20 def ==(other) other.respond_to?(:id) && other.id == self.id end |
#initialize(attrs = {}) ⇒ Object
14 15 16 17 18 |
# File 'lib/dynamoid/document.rb', line 14 def initialize(attrs = {}) @new_record = true @attributes ||= {} self.class.attributes.each {|att| write_attribute(att, attrs[att])} end |