Module: N::Entity

Includes:
Managed
Included in:
Relation
Defined in:
lib/n/db/mixins.rb

Overview

Entity

The default managed Object. Include this mixin to the objects to be managed by Db.

Instance Attribute Summary

Attributes included from Managed

#join_fields

Instance Method Summary collapse

Methods included from Managed

#__ancestors_classes, #__db_insert, #__db_update, #__descendants_classes, eval_db_insert, eval_db_read_row, eval_db_update, eval_dbseq, eval_dbtable

Instance Method Details

#__db_pkObject



34
35
36
# File 'lib/n/db/mixins.rb', line 34

def __db_pk
	return "oid"
end

#__db_pre_delete(conn) ⇒ Object

Default implementation, cascading delete. Typically used for cascading deletes, executed in a transaction, do NOT error-check here!



50
51
52
# File 'lib/n/db/mixins.rb', line 50

def __db_pre_delete(conn)
	conn.delete_descendants(@oid, self.class)
end

#__db_pre_insert(conn) ⇒ Object

Default implementation, calculates the oid primary key.



40
41
42
43
44
# File 'lib/n/db/mixins.rb', line 40

def __db_pre_insert(conn)
	# gmosx, INVESTIGATE: is this neeed?
	super
	@oid = conn.next_oid(self.class)		
end

#initialize(*args) ⇒ Object



28
29
30
# File 'lib/n/db/mixins.rb', line 28

def initialize(*args)
	super
end

#to_iObject



54
55
56
# File 'lib/n/db/mixins.rb', line 54

def to_i()
	return @oid
end