Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upMultiple foreign keys with #[belongs_to], conflicting implementations of trait #616
Comments
This comment has been minimized.
|
I don't think you can join more than 2 tables for now, have a look at #89 |
This comment has been minimized.
|
@Eijebong You can't join to more than two tables in a single query, but having multiple associations on a single model is definitely supported. This is a bug. |
This comment has been minimized.
|
Ah, I see what's going on now. The issue isn't that there are multiple associations, it's that this is a self-referential association. |
This comment has been minimized.
Boscop
commented
Feb 8, 2017
|
Yeah, posts can have a parent post that they reply to. |
This comment has been minimized.
|
If by "Will it be possible in the future" you mean "is this a thing that I think is reasonable to do and want to support eventually?", then the answer is yes. If you mean "is this a thing you are actively working on and have a concrete timeline for?" then the answer is no |
This comment has been minimized.
|
As I was writing that I realized this is literally just an if statement in codegen. I'm 99% certain the only problem with it is the invocations of |
sgrif
added
the
accepted
label
Feb 8, 2017
sgrif
added this to the 0.11 milestone
Feb 8, 2017
This comment has been minimized.
Boscop
commented
Feb 8, 2017
|
Yay! |
Boscop commentedFeb 4, 2017
I have a table
posts, and every post has an author (user_id) and a possible parent post that it replies to:But I get:
What's the correct way to declare multiple foreign keys for this kind of usecase?