Create relationship with itself
How can we add a relationship from some resource to itself?
For example, let's say I have a
User
resource and I add a feature that an user can create another user, meaning that I want to add a field called created_by
and created_by_id
which is also an User
4 Replies
yep!
Hmm, yep what? hahahaha.
Basically I tried adding a has_one or belongs_to blocks using the resource module itself but they will fail when creating the migration with
** (RuntimeError) Error while running transformer AshPostgres.Transformers.EnsureTableOrPolymorphic: "Non-polymorphic resources must have a postgres table configured."
You can relate a resource to itself
that error implies you haven't configured a table for a resource
like
Hmm, I guess there was some problem with an alias to the resource, because the issue was that it was not finding the resource 🤦♂️