motion/cdq.rb in cdq-0.1.8 vs motion/cdq.rb in cdq-0.1.9

- old
+ new

@@ -49,10 +49,12 @@ @@base_object ||= CDQObject.new case obj when Class if obj.isSubclassOfClass(NSManagedObject) - entity_description = @@base_object.models.current.entitiesByName[obj.name] + entity_description = + @@base_object.models.current.entitiesByName[obj.name] || + @@base_object.models.current.entitiesByName[obj.ancestors[1].name] if entity_description.nil? raise "Cannot find an entity named #{obj.name}" end CDQTargetedQuery.new(entity_description, obj) else