Started working on casted models, basic functionalities are now in.
property :casted_attribute, :cast_as => 'WithCastedModelMixin' A casted attribute now knows about its parent. (#casted_by to retrieve the parent's object)
This commit is contained in:
parent
fa7b176fce
commit
621f5565e9
10 changed files with 177 additions and 40 deletions
|
@ -15,7 +15,7 @@ module CouchRest
|
|||
class ExtendedDocument < Document
|
||||
include CouchRest::Callbacks
|
||||
include CouchRest::Mixins::DocumentQueries
|
||||
include CouchRest::Mixins::DocumentProperties
|
||||
include CouchRest::Mixins::Properties
|
||||
include CouchRest::Mixins::Views
|
||||
include CouchRest::Mixins::DesignDoc
|
||||
|
||||
|
@ -25,8 +25,8 @@ module CouchRest
|
|||
|
||||
def initialize(keys={})
|
||||
super
|
||||
apply_defaults # defined in CouchRest::Mixins::DocumentProperties
|
||||
# cast_keys
|
||||
apply_defaults # defined in CouchRest::Mixins::Properties
|
||||
cast_keys # defined in CouchRest::Mixins::Properties
|
||||
unless self['_id'] && self['_rev']
|
||||
self['couchrest-type'] = self.class.to_s
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue