Class: CouchbaseOrm::NestedDocument

Inherits:
Document
  • Object
show all
Defined in:
lib/couchbase-orm/base.rb

Instance Method Summary collapse

Methods inherited from Document

#[], #[]=, #attributes

Methods included from Encrypt

#as_json, #decode_encrypted_attributes, #encode_encrypted_attributes, #to_json

Methods included from ActiveRecordCompat

#_has_attribute?, #_write_attribute, #attribute_for_inspect, #attribute_names, #attribute_present?, #format_for_inspect, #has_attribute?, #read_attribute

Constructor Details

#initialize(*args, **kwargs) ⇒ NestedDocument

Returns a new instance of NestedDocument.



213
214
215
216
217
218
# File 'lib/couchbase-orm/base.rb', line 213

def initialize(*args, **kwargs)
  super
  return unless respond_to?(:id) && id.nil?

  assign_attributes(id: SecureRandom.hex)
end