Allowing save of default value for read-only property
This commit is contained in:
parent
9d4837993a
commit
406eaebfc9
2 changed files with 6 additions and 6 deletions
|
@ -23,8 +23,8 @@ module CouchRest
|
|||
# TODO: cache the default object
|
||||
self.class.properties.each do |property|
|
||||
key = property.name.to_s
|
||||
# let's make sure we have a default and we can assign the value
|
||||
if !property.default.nil? && (self.respond_to?("#{key}=") || self.key?(key))
|
||||
# let's make sure we have a default
|
||||
if property.default
|
||||
if property.default.class == Proc
|
||||
self[key] = property.default.call
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue