The manage_relationship
[1] documentation[2] says that relationship has to be specified before inputs:
manage_relationship(changeset, relationship, input, opts \\ [])
However doing so, throws an error.
Also, the example [3] in alembic’s realworld repo, calls the function in this way:
change manage_relationship(:target_id, :target, type: :append)
...
relationships do
...
belongs_to :target, Realworld.Accounts.User do
api Realworld.Accounts
allow_nil? false
primary_key? true
end
end
Why is :target
specified after :target_id
? Isn’t :target
the relationship?
–
[1] ash/lib/ash/changeset/changeset.ex at v2.21.13 · ash-project/ash · GitHub
[2] Ash.Changeset — ash v2.21.13
[3] realworld/lib/realworld/profiles/resources/follow.ex at 5ddc03e7bc9accfa30327e823450357e56e6c56d · team-alembic/realworld · GitHub