Improvements for ExtendedDocument initializer
* Tries to send arg= to the Document before setting the attribute Signed-off-by: Matt Aimonetti <mattaimonetti@gmail.com>
This commit is contained in:
parent
6fca60ebe4
commit
75a5018b12
3 changed files with 30 additions and 3 deletions
|
@ -126,4 +126,4 @@ module CouchRest
|
|||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -33,6 +33,11 @@ module CouchRest
|
|||
|
||||
def initialize(passed_keys={})
|
||||
apply_defaults # defined in CouchRest::Mixins::Properties
|
||||
passed_keys.each do |k,v|
|
||||
if self.respond_to?("#{k}=")
|
||||
self.send("#{k}=", passed_keys.delete(k))
|
||||
end
|
||||
end if passed_keys
|
||||
super
|
||||
cast_keys # defined in CouchRest::Mixins::Properties
|
||||
unless self['_id'] && self['_rev']
|
||||
|
@ -212,4 +217,4 @@ module CouchRest
|
|||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue