Dirigible
AEAsh Elixir
•Created by Dirigible on 8/8/2023 in #support
Filter by struct keys in a read action
So I have an ash actions.
It receives a struct as an input.
I want to create a filter that filters by values inside the struct.
here's a simplified version of the action:
I get an error like this:
Is there a way to get the key out within a filter like this, or will I need to filter the data in a different way?
Is the only way of doing this through a preparation?
6 replies
AEAsh Elixir
•Created by Dirigible on 6/7/2023 in #support
Deleting resources that have existing relationships
Version info:
So I have a Ash Postgres resource, lets call it
Car
.
I also have another Ash Postgres resource called CarLog
.
Whenever a change happens to Car
a CarLog
with the nature of the change is created. (so 1:many relation between Car
:CarLog
)
However if a resource instance of Car
is deleted I don't want to delete and of the CarLog
s associated with it.
In my CarLog
resource I have:
To my understanding this should make it possible to destroy a Car
resource instance, and leave the associated CarLog
s behind?
However, when I try to delete a Car
with existing CarLog
s I'm getting this error:
I've found the source of the error in ash_postgres
, and seems to because it doesn't meet a foreign key constraint:
https://github.com/ash-project/ash_postgres/blob/0ad06c6b636c4b4d3ff66971ddde68828d446667/lib/data_layer.ex#L1484-L1485
What do I need to do to allow the destruction of resources instances that have references to others?10 replies
AEAsh Elixir
•Created by Dirigible on 2/26/2023 in #support
How to Delete Resource?
I have a resource that has attributes and relationships to other resources. I want to delete it completely, how would I do that?
6 replies