Module: Og::EntityMixin

Includes:
RelationDSL
Included in:
Glue::Taggable, Entity
Defined in:
lib/og/entity.rb

Overview

Include this module to classes to make them managable by Og.

Instance Method Summary collapse

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, options = {})
  Property.populate_object(self, values, options)
  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

#insertObject



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

#reloadObject 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(options = nil)
  self.class.ogmanager.store.save(self, options)
  # return self
end

#saved?Boolean Also known as: serialized?

Returns:

  • (Boolean)


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(options = nil)
  self.class.ogmanager.store.update(self, options)
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