Skip to content

How I can handle a many to many relationship between two diferent apis? #872

Closed Answered by zachdaniel
hackemateninja asked this question in Q&A
Discussion options

You must be logged in to vote

given this relationship, where the through resource is in the source api not in Other.Api

many_to_many :friends, User do
  through FriendLink
  ...
  api Other.Api
end

you can split the has_many relationship out with a different api configured (or likely in your case, no api configured)

has_many :friend_links, FriendLink do
  ...
  # don't configure an api, since its in the same source api
end

many_to_many :friends, Friend do
  ...
  join_relationship 
end

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@hackemateninja
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by hackemateninja
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants