Reputation: 384
I have a Person object with the uuid
column. Each person has_many blogs, each blog belongs_to a person.
I would like for blog.person_id
to return the Person.UUID
, and blog.person to return the person object.
Is there a way to do this without making Person's primary key its own UUID?
Upvotes: 0
Views: 47
Reputation: 118261
Mention the column name with primary_key
option.
has_many blogs, primary_key: "uuid"
:primary_key
Specify the name of the column to use as the primary key for the association. By default this is
id
.
Upvotes: 3