Multiple belong_to's to same entity #2699
somehowchris
started this conversation in
Ideas
Replies: 1 comment
-
This is currently not supported for the reasons listed in #2142. Also we do not plan to add support for this anytime soon as for the ambiguity reasons listed in the linked issue + the alternative is clearer and not really longer than having the foreign key explicitly on each call to |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey :),
I'm somwhat new to diesel and rust but I couldn't find the feature related to the problem but I shouldn't be the only one using some setup like the following.
For a school project we have a currency, a currency pair consisting out of two currencies and market data belonging to a currency pair. The main problem is the
#blongs_to
part which I populated with the entity and the foreign_key as needed twice in the currency pair entity but diesel returns an errors at compile time because these two seem to conflict.If I'm totally off just RTFM me. But as I couldn't find a solution heres a proposal:
Give every belongs_to part a
name
attribute which can be set manually just like theforeign_key
. That again cloud be used at load calls where you would dobelonging_to(posts, "<previous given name>")
Beta Was this translation helpful? Give feedback.
All reactions