From de0878c84ba9eb010ff29f3dab09c85a7e43c279 Mon Sep 17 00:00:00 2001 From: Sam Lown Date: Thu, 11 Mar 2010 10:49:54 +0000 Subject: [PATCH] Adding fix for ruby1.9.1 when Array casted property is not provided an array --- lib/couchrest/mixins/properties.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/couchrest/mixins/properties.rb b/lib/couchrest/mixins/properties.rb index 368b3c0..bb2264e 100644 --- a/lib/couchrest/mixins/properties.rb +++ b/lib/couchrest/mixins/properties.rb @@ -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