Forum: Rails-core (closed, excessive spam) Patch to add :primary_key option to has_many and has_one associations

Posted by Brad Greenlee (Guest)
on 2008-06-03 22:19
(Received via mailing list)
Hey all. I'm pimping for a patch that my colleague, Andre Arko,
submitted originally:

http://rails.lighthouseapp.com/projects/8994/ticke...

I extended it to work with has_one associations, too. We have a couple
instances in our app where we need an association that isn't keyed off
the default primary key of the model. This patch allows you to use
a :primary_key option to specify which key in the model should be used
for the association.

Cheers,

-b
Posted by John D. Hume (Guest)
on 2008-06-04 04:35
(Received via mailing list)
This sounds like a good feature, but isn't "primary_key" a confusing
choice of names for that option? What about  "alternate_key"?
-hume.
Posted by Brad Greenlee (Guest)
on 2008-06-04 06:29
(Received via mailing list)
Yeah, I was thinking that myself. What about just :key?

-b
This topic is locked and can not be replied to.