# \[ANN\] Composite Primary Keys support for Associations

**URL:** <https://www.ruby-forum.com/t/ann-composite-primary-keys-support-for-associations/100988>\
**Category:** Ruby\
**Created:** [August 2, 2006, 11:21am UTC](https://www.ruby-forum.com/t/ann-composite-primary-keys-support-for-associations/100988 "2006-08-02T11:21:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicwilliams](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/aca169/32.png) [@nicwilliams](https://www.ruby-forum.com/u/nicwilliams)\
**Post date:** [August 2, 2006, 11:21am UTC](https://www.ruby-forum.com/t/ann-composite-primary-keys-support-for-associations/100988/1 "2006-08-02T11:21:45Z")

</div>

[Cross-post from Ruby on Rails list]

Announcement:  
Composite Primary Keys gem now includes support for ActiveRecord  
Associations.

Summary:  
Composite Primary Keys allows an ActiveRecord to support 2+ primary keys  
using the set\_primary\_keys class method. Previous versions provided full  
CRUD and find support. This latest release provides support for more  
ActiveRecord magic: associations (has\_many, belongs\_to, etc)

Full report:  
[http://drnicwilliams.com/2006/08/02/composite-primary-keys-supports-associations/](http://drnicwilliams.com/2006/08/02/composite-primary-keys-supports-associations/)

Cheers  
Dr Nic

---

<div class="post-metadata">

**Author:** ![nicwilliams](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/aca169/32.png) [@nicwilliams](https://www.ruby-forum.com/u/nicwilliams)\
**Post date:** [August 3, 2006, 12:33pm UTC](https://www.ruby-forum.com/t/ann-composite-primary-keys-support-for-associations/100988/2 "2006-08-03T12:33:37Z")

</div>

Hello my windowed friend! Glad to hear you’re making good progress  
with this interesting tool.

What kind of integration into Migrations does it have? Are you looking  
for any kind of help on that front?

M.T.

---

<div class="post-metadata">

**Author:** ![nicwilliams](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/aca169/32.png) [@nicwilliams](https://www.ruby-forum.com/u/nicwilliams)\
**Post date:** [August 3, 2006, 2:11pm UTC](https://www.ruby-forum.com/t/ann-composite-primary-keys-support-for-associations/100988/3 "2006-08-03T14:11:08Z")

</div>

> What kind of integration into Migrations does it have? Are you looking  
> for any kind of help on that front?

My initial aim was to get it working for legacy dbs - ppl who already  
had composite keys to live with. Like me.

I think it’d be nice for join tables, for example, to be able to have  
explicit composite keys via migrations. But other than that, I assumed  
most people - given the chance - would want to have lovely, free, single  
primary keys.

If you whip up any code for migration support yourself, then email me  
and/or dump it on the forum ([http://groups.google.com/compositekeys](http://groups.google.com/compositekeys)).

Cheers  
Nic
