Should be able to assign a casted hash to a hash property

Fixes https://github.com/couchrest/couchrest_model/issues/68

Signed-off-by: Marcos Tapajós <tapajos@gmail.com>
This commit is contained in:
Kostiantyn Kahanskyi 2011-06-06 18:07:33 +02:00 committed by Marcos Tapajós
parent a55cf56213
commit d50d47c32a
3 changed files with 17 additions and 1 deletions

View file

@ -39,7 +39,7 @@ module CouchRest::Model
arr = value.collect { |data| cast_value(parent, data) }
# allow casted_by calls to be passed up chain by wrapping in CastedArray
CastedArray.new(arr, self, parent)
elsif (type == Object || type == Hash) && (value.class == Hash)
elsif (type == Object || type == Hash) && (value.kind_of?(Hash))
# allow casted_by calls to be passed up chain by wrapping in CastedHash
CastedHash[value, self, parent]
elsif !value.nil?