Module: Og::EntityMixin
Overview
Include this module to classes to make them managable by Og.
Instance Method Summary collapse
- #assign_properties(values, options = {}) ⇒ Object (also: #assign)
-
#delete(cascade = true) ⇒ Object
(also: #delete!)
Delete this entity instance from the store.
- #insert ⇒ Object
- #og_quote(obj) ⇒ Object
-
#reload ⇒ Object
(also: #reload!)
Reload this entity instance from the store.
- #save(options = nil) ⇒ Object (also: #save!)
- #saved? ⇒ Boolean (also: #serialized?)
- #transaction(&block) ⇒ Object
- #update(options = nil) ⇒ Object
- #update_by_sql(set) ⇒ Object (also: #update_sql, #supdate)
- #update_properties(*properties) ⇒ Object (also: #update_property, #pupdate)
Instance Method Details
#assign_properties(values, options = {}) ⇒ Object Also known as: assign
67 68 69 70 |
# File 'lib/og/entity.rb', line 67 def assign_properties(values, = {}) Property.populate_object(self, values, ) return self end |
#delete(cascade = true) ⇒ Object Also known as: delete!
Delete this entity instance from the store.
49 50 51 |
# File 'lib/og/entity.rb', line 49 def delete(cascade = true) self.class.ogmanager.store.delete(self, self.class, cascade) end |
#insert ⇒ Object
19 20 21 22 |
# File 'lib/og/entity.rb', line 19 def insert self.class.ogmanager.store.insert(self) return self end |
#og_quote(obj) ⇒ Object
63 64 65 |
# File 'lib/og/entity.rb', line 63 def og_quote(obj) self.class.ogmanager.store.quote(obj) end |
#reload ⇒ Object Also known as: reload!
Reload this entity instance from the store.
42 43 44 |
# File 'lib/og/entity.rb', line 42 def reload self.class.ogmanager.store.reload(self, self.pk) end |
#save(options = nil) ⇒ Object Also known as: save!
13 14 15 16 |
# File 'lib/og/entity.rb', line 13 def save( = nil) self.class.ogmanager.store.save(self, ) # return self end |
#saved? ⇒ Boolean Also known as: serialized?
58 59 60 |
# File 'lib/og/entity.rb', line 58 def saved? not @oid.nil? end |
#transaction(&block) ⇒ Object
54 55 56 |
# File 'lib/og/entity.rb', line 54 def transaction(&block) self.class.ogmanager.store.transaction(&block) end |
#update(options = nil) ⇒ Object
24 25 26 |
# File 'lib/og/entity.rb', line 24 def update( = nil) self.class.ogmanager.store.update(self, ) end |
#update_by_sql(set) ⇒ Object Also known as: update_sql, supdate
34 35 36 |
# File 'lib/og/entity.rb', line 34 def update_by_sql(set) self.class.ogmanager.store.update_by_sql(self, set) end |
#update_properties(*properties) ⇒ Object Also known as: update_property, pupdate
28 29 30 |
# File 'lib/og/entity.rb', line 28 def update_properties(*properties) self.class.ogmanager.store.update(self, :only => properties) end |