Class: Kangaroo::Model::Base
- Inherits:
-
Object
- Object
- Kangaroo::Model::Base
- Extended by:
- ActiveModel::Callbacks, Finder, OpenObjectOrm
- Includes:
- Attributes, DefaultAttributes, Inspector, Persistence, RemoteExecute
- Defined in:
- lib/kangaroo/model/base.rb
Constant Summary
Constants included from ConditionNormalizer
ConditionNormalizer::CONDITION_OPERATORS, ConditionNormalizer::CONDITION_PATTERN
Constants included from Finder
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
- .fields ⇒ Object
- .namespace ⇒ Object
-
.oo_name ⇒ Object
Return this models OpenObject name.
-
.remote ⇒ Object
Send method calls via xmlrpc to OpenERP.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Base
constructor
Initialize a new object, and set attributes.
-
#remote ⇒ Object
Send method calls via xmlrpc to OpenERP.
Methods included from OpenObjectOrm
create_record, default_get, fields_get, read, search, unlink, write_record
Methods included from Finder
all, count, exists?, find, first, last
Methods included from RemoteExecute
Methods included from Persistence
#destroy, #destroyed?, #new_record?, #persisted?, #reload, #save, #save!
Methods included from Attributes
#attributes, #attributes=, #freeze, #read_attribute, #write_attribute
Constructor Details
#initialize(attributes = {}) ⇒ Base
Initialize a new object, and set attributes
34 35 36 37 38 39 40 |
# File 'lib/kangaroo/model/base.rb', line 34 def initialize attributes = {} @attributes = {} _run_initialize_callbacks do self.attributes = attributes end end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
29 30 31 |
# File 'lib/kangaroo/model/base.rb', line 29 def id @id end |
Class Method Details
.fields ⇒ Object
49 50 51 |
# File 'lib/kangaroo/model/base.rb', line 49 def fields @fields ||= fields_get end |
.namespace ⇒ Object
53 54 55 |
# File 'lib/kangaroo/model/base.rb', line 53 def namespace ("::" + name.match(/^(?:\:\:)?([^\:]+)/)[1]).constantize end |
.oo_name ⇒ Object
Return this models OpenObject name
58 59 60 |
# File 'lib/kangaroo/model/base.rb', line 58 def oo_name namespace.ruby_to_oo self.name end |
.remote ⇒ Object
Send method calls via xmlrpc to OpenERP
64 65 66 |
# File 'lib/kangaroo/model/base.rb', line 64 def remote @remote ||= database.object oo_name end |
Instance Method Details
#remote ⇒ Object
Send method calls via xmlrpc to OpenERP
44 45 46 |
# File 'lib/kangaroo/model/base.rb', line 44 def remote self.class.remote end |