motion/managed_object.rb in cdq-1.0.8 vs motion/managed_object.rb in cdq-2.0.0

- old
+ new

@@ -97,10 +97,20 @@ !@cdq_object.nil? end end + def update(args) + args.each do |k,v| + if respond_to?("#{k}=") + self.send("#{k}=", v) + else + raise UnknownAttributeError.new("#{self.class} does not respond to `#{k}=`") + end + end if args.is_a?(Hash) + end + # Register this object for destruction with the current context. Will not # actually be removed until the context is saved. # def destroy managedObjectContext.deleteObject(self) @@ -209,5 +219,7 @@ didAccessValueForKey(name) set end end + +class UnknownAttributeError < StandardError; end