relationship required

Hey! Whats the best way to fix this error?
%Ash.Error.Changes.Required{
field: :account,
type: :relationship,
resource: nil,
changeset: nil,
query: nil,
error_context: [],
vars: [],
path: [],
stacktrace: #Stacktrace<>,
class: :invalid
}
%Ash.Error.Changes.Required{
field: :account,
type: :relationship,
resource: nil,
changeset: nil,
query: nil,
error_context: [],
vars: [],
path: [],
stacktrace: #Stacktrace<>,
class: :invalid
}
I already tried including account_id and account in the changeset, this is what I have currently
Vehicle
|> Ash.Changeset.for_create(
:create,
%{
account: account,
....
}
)
|> AshApi.create([])
Vehicle
|> Ash.Changeset.for_create(
:create,
%{
account: account,
....
}
)
|> AshApi.create([])
2 Replies
ZachDaniel
ZachDaniel2y ago
So to include account you’d need to add a manage_relationship change in your action To include account_id you’d need to set attribute_writable? in your belongs to relationship
harry
harryOP2y ago
Thanks Zach!

Did you find this page helpful?