# UUID and primary\_key inference on associations

**URL:** <https://discourse.rom-rb.org/t/uuid-and-primary-key-inference-on-associations/144>\
**Category:** Issues\
**Created:** [March 31, 2017, 11:17am UTC](https://discourse.rom-rb.org/t/uuid-and-primary-key-inference-on-associations/144 "2017-03-31T11:17:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![glenndavy](https://avatars.discourse-cdn.com/v4/letter/g/ecae2f/32.png) [@glenndavy](https://discourse.rom-rb.org/u/glenndavy)\
**Post date:** [March 31, 2017, 11:17am UTC](https://discourse.rom-rb.org/t/uuid-and-primary-key-inference-on-associations/144/1 "2017-03-31T11:17:43Z")

</div>

Hi there  
I’ve been able to create pg relations that stores UUID into tables in the ‘id’ field. However, it seems to be unable to use .associate(:parent) when creating a changset, I need to specify ‘primary\_key :id’ in the schema so that the pk can be inferred. The problem that flows from that is that doing so expects the pk to be an integer, so the whole thing breaks.

what would be the correct way to either specify the primary\_key when its not an integer or to otherwise be able to infer the association when writing the child record?

thanks for any insights

---

<div class="post-metadata">

**Author:** ![solnic](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.rom-rb.org/solnic/32/279_2.png) [@solnic](https://discourse.rom-rb.org/u/solnic)\
**Post date:** [April 5, 2017, 9:53am UTC](https://discourse.rom-rb.org/t/uuid-and-primary-key-inference-on-associations/144/2 "2017-04-05T09:53:31Z")

</div>

Please report an issue in rom-repository with a script showing what you want to achieve, and we’ll take it from there.

---

<div class="post-metadata">

**Author:** ![glenndavy](https://avatars.discourse-cdn.com/v4/letter/g/ecae2f/32.png) [@glenndavy](https://discourse.rom-rb.org/u/glenndavy)\
**Post date:** [April 5, 2017, 1:27pm UTC](https://discourse.rom-rb.org/t/uuid-and-primary-key-inference-on-associations/144/3 "2017-04-05T13:27:56Z")

</div>

Thanks sonic, will do.
