-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Association improvements #307
Association improvements #307
Conversation
Bang versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 Much needed feature! thx.
primary courier_id : Int32, auto: false | ||
field! issuer_id : Int32 | ||
|
||
belongs_to service : CourierService, primary_key: "owner_id" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Blacksmoke16 just to confirm, can you use a Symbol instead of a String for the value?
belongs_to service : CourierService, primary_key: :owner_id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like mysql
is failing. :-(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, ill take a look.
Should be able to, just sets it and calls .id
on them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@drujensen I figured it out, see 2e80d10.
I guess no other spec had it setup like I did this one time. 🤷♂️
EDIT: And yea, symbol primary_key:
values works 👌
belongs_to
andhas_one
associations.belongs_to
andhas_one
associations.has_many
association use whatever primary key is defined on the model, vs always assumingid