Validate belongs_to exists
How can I validate that for the following resource the
level_id
is not blank and that the Level
resource for that level_id
exists?
1 Reply
If you are using AshPostgres and the migration generator, that will be done for you.
Well, the "ensuring it exists" part will be.
Otherwise, add
If you aren't using AshPostgres, you may want to use
manage_relationship(:level, type: :append_and_remove)
to change the level
because that will first look up the relevant level in the target resource.