Module: N::Entity
Overview
Entity
The default managed Object. Include this mixin to the objects to be managed by Db.
Instance Attribute Summary
Attributes included from Managed
Instance Method Summary collapse
- #__db_pk ⇒ Object
-
#__db_pre_delete(conn) ⇒ Object
Default implementation, cascading delete.
-
#__db_pre_insert(conn) ⇒ Object
Default implementation, calculates the oid primary key.
- #initialize(*args) ⇒ Object
- #to_i ⇒ Object
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_pk ⇒ Object
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_i ⇒ Object
54 55 56 |
# File 'lib/n/db/mixins.rb', line 54 def to_i() return @oid end |