Read Action Prepare does not load aggregate
I have a resource with a count aggregate for a child resource
I then have a default read action that uses prepare and build to load the aggregate
Note that I have currently loaded responses to use the length method to get a count, but whenever I attempt to access response_count it returns an Ash.NotLoaded<:aggregate> value.
Loving ASH btw, It cuts down on a lot of the boilerplate that you get with normal Phoenix contexts.
2 Replies
I think you have to put, everything into load, at least I have loaded calculations that way. Haven't really used aggregates so far.
If I've understood the documentation correctly you can add an ad-hoc aggregate using the aggregate option (an aggregate that you haven't already specified on the resource)
Yeah, you're right. Thanks!