-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Associated id is save automatically? #199
Comments
Hi, thanks for using REL and reporting this, Currently REL checks if foreign and association key have the same key to prevent modifying association of other records. Lines 636 to 651 in 9969cea
but I think it's make sense to support your case for belongs to, we can set the reference value if it's a zero value around here: Lines 558 to 567 in 9969cea
let me know if you are interested to submit fix for this, Thank you |
Hi! Thank for your answer. Let me give it a check and I send my PR. :D |
Thank you, let me know if you have any question! |
Hi!.
I'm having a little problem to save an associated id. I don't know if I'm doing it well. Let me explain what it is happen to me.
I have this db struct:
These are my go models:
I want to save an Author instance and pass it to a Book instance. I was expecting that the relation would save AuthorID automatically but no. It shows this error:
This is the code I'm running:
Now my questing here is if this can be done. I don have any problem to pass the id to the association, but I thing would be great to pass the saved instance and rel takes the associated id to save it.
Thanks!!! 🏆 REL is awesome! 😃
The text was updated successfully, but these errors were encountered: