explode-foreign-key now returns an empty instance if the key is NIL. also, as a secon...
[clinton/lisp-on-lines.git] / src / meta-model.lisp
index b0d1ff5..9ea1d3c 100644 (file)
   "returns the clsql view-class joined on SLOT"
   (dolist (s (list-join-attributes model))
     (when (equal (getf (cdr s) :home-key) slot)
   "returns the clsql view-class joined on SLOT"
   (dolist (s (list-join-attributes model))
     (when (equal (getf (cdr s) :home-key) slot)
-      (return-from explode-foreign-key (slot-value model (car s))))))
+      (let ((val (slot-value model (car s))))
+      (return-from explode-foreign-key 
+       (values (if val val (make-instance (getf (cdr s) :join-class))) (getf (cdr s) :foreign-key)))))))
 
 (defun find-join-helper (foreign-key)
   (lambda (class slot) 
 
 (defun find-join-helper (foreign-key)
   (lambda (class slot)