# Composite Key Support

**URL:** <https://www.ruby-forum.com/t/composite-key-support/54296>\
**Category:** Rails\
**Created:** [February 28, 2006, 9:24pm UTC](https://www.ruby-forum.com/t/composite-key-support/54296 "2006-02-28T21:24:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcernelli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/73ab20/32.png) [@jcernelli](https://www.ruby-forum.com/u/jcernelli)\
**Post date:** [February 28, 2006, 9:24pm UTC](https://www.ruby-forum.com/t/composite-key-support/54296/1 "2006-02-28T21:24:43Z")

</div>

Right now rails doesn’t support composite keys, that is id1, id2, and  
id3 are in the primary key of the table. Does anyone know if this is  
being discussed for future versions, or is it pretty much out of scope?

---

<div class="post-metadata">

**Author:** ![jcernelli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/73ab20/32.png) [@jcernelli](https://www.ruby-forum.com/u/jcernelli)\
**Post date:** [February 28, 2006, 9:49pm UTC](https://www.ruby-forum.com/t/composite-key-support/54296/2 "2006-02-28T21:49:06Z")

</div>

hah, I’m very tantalized! I’m off to check it out now, thanks for the  
tip!

---

<div class="post-metadata">

**Author:** ![jcernelli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/73ab20/32.png) [@jcernelli](https://www.ruby-forum.com/u/jcernelli)\
**Post date:** [February 28, 2006, 9:45pm UTC](https://www.ruby-forum.com/t/composite-key-support/54296/3 "2006-02-28T21:45:17Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

On Feb 28, 2006, at 12:24 PM, Joe C. wrote:

> Right now rails doesn’t support composite keys, that is id1, id2, and  
> id3 are in the primary key of the table. Does anyone know if this is  
> being discussed for future versions, or is it pretty much out of  
> scope?

Composite keys would surely inch further in-scope if some  
enterprising soul had a thoroughly tested implementation to flog us  
with.

The polymorphic joins DHH did for Rails 1.1 are a nice example of  
working with composite foreign keys.

Please do investigate if sufficiently tantalized 😉

Best,  
jeremy  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.2 (Darwin)

iD8DBQFEBLZIAQHALep9HFYRAjDhAJ9kkI4ox4chhuvAOKxVEz4nWmjLYACfQvVP  
wy8FRX+s2jIPgqaC+uFKe8w=  
=aLH2  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![jcernelli](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/73ab20/32.png) [@jcernelli](https://www.ruby-forum.com/u/jcernelli)\
**Post date:** [March 1, 2006, 1:52pm UTC](https://www.ruby-forum.com/t/composite-key-support/54296/4 "2006-03-01T13:52:33Z")

</div>

It is pretty much out of scope. The consensus is that there is no  
obvious benefit of this particular feature. I tend to think  
otherwise, but oh well…

cheers,  
daesan
