fixed a bug with the RestClient optimization, added more callbacks on the ExtendedDocument and added support for casted arrays of objects.

This commit is contained in:
Matt Aimonetti 2009-02-12 20:28:07 -08:00
parent b79bb9a912
commit 3a57ed1414
9 changed files with 277 additions and 56 deletions

View file

@ -40,8 +40,8 @@ module CouchRest
key = self.has_key?(property.name) ? property.name : property.name.to_sym
target = property.type
if target.is_a?(Array)
next unless self[key]
klass = ::CouchRest.constantize(target[0])
self[property.name] = self[key].collect do |value|
# Auto parse Time objects
obj = ( (property.init_method == 'new') && klass == Time) ? Time.parse(value) : klass.send(property.init_method, value)