Make "property :foo, :default => false" work
Before a default value of false was treated like a default of nil, which is not the same. Signed-off-by: Matt Aimonetti <mattaimonetti@gmail.com>
This commit is contained in:
parent
75a5018b12
commit
f7bbee8243
3 changed files with 9 additions and 3 deletions
|
@ -24,7 +24,7 @@ module CouchRest
|
|||
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 && (self.respond_to?("#{key}=") || self.key?(key))
|
||||
if !property.default.nil? && (self.respond_to?("#{key}=") || self.key?(key))
|
||||
if property.default.class == Proc
|
||||
self[key] = property.default.call
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue