Using an inline aggregate of unrelated resource filtering by related resources
I believe I could do this using a custom relationship and falling back to Ecto, but I was wondering if there was a "Ash way" of doing what I'm trying to do here.
I have four resources/tables
SceneWidget
Scene
WidgetVersion
WidgetMemory
I'm trying to write a calculation to go from
SceneWidget => WidgetMemory
Using SQL I would normally write something like
Trying to do this as a calculation I've tried:
and
But neither seem to work. Does Ash have a suggestion on how to to model these complex relationships? Or are you meant to just fallback to CustomRelationship/Ecto in these situations?2 Replies
I found a solution, but there still seems to be a bug here?
It now works if I call
EKG.Scenes.SceneWidget |> Ash.read_one(load: [:channel_id, :widget_id, :memory], authorize?: false)
But if I only call EKG.Scenes.SceneWidget |> Ash.read_one(load: [:memory], authorize?: false) I get the following error:
I would have though the load option would ensure these other two calulations where loaded?
This is all with Ash 3.5.37 BTWIt should, can you try with the newest version and if it does not work there submit a but report / failing test please