I've sent a pull request to John.
Jim
--
Jim Menard, http://www.io.com/~jimm/
Thank you for pulling my changes. I have a question about the
simplification you did in associations/belongs-to. I had
I had
foreign-key-attribute (keyword (cond
(:fk opts) (:fk opts)
(:model opts) (str
(dashes-to-underscores (str association-name)) "_id")
:else (str (dashes-to-underscores
associated-model-name) "_id")))
which you changed to
foreign-key-attribute (keyword (or
(:fk opts)
(str (dashes-to-underscores
associated-model-name) "_id")))
However I don't think this will work as intended (at least, as I
intended). Given the association
(belongs-to mother :model person)
the code I submitted will infer a foreign key name of mother_id, which
is the behavior I wanted. The code you changed it to will use
person_id instead. Consider the situaion where you have a table with
mother_id and father_id which both point to the person table. With my
original code, you could write
(belongs-to mother :model person)
(belongs-to father :model person)
but with your code I have to write
(belongs-to mother :fk mother_id :model person)
(belongs-to father :fk father_id :model person)
That is why I have the extra case in the cond in the original code.
Did you change it because you disagree with my intention and want the
default fk to match the association name?
Jim
Jim
A git question. Either I'm crazy and it was association-name all
along, or you changed associated-model-name to association-name
without creating a new git commit. How did you do that?
Jim