Adding fix for ruby1.9.1 when Array casted property is not provided an array

This commit is contained in:
Sam Lown 2010-03-11 10:49:54 +00:00
parent c906be229f
commit de0878c84b

View file

@ -51,7 +51,8 @@ module CouchRest
return unless self[key]
if property.type.is_a?(Array)
klass = ::CouchRest.constantize(property.type[0])
arr = self[key].dup.collect do |value|
self[key] = [self[key]] unless self[key].is_a?(Array)
arr = self[key].collect do |value|
value = typecast_value(value, klass, property.init_method)
associate_casted_to_parent(value, assigned)
value