What should be the behavior of `after_action`?
The function in
after_action
is being called before prepare build(load: [:roles])
. Is this normal behavior?
3 Replies
its not that its called before it, its that the query loads aren't run until the very end
the preparation happens first and mofies the query
but we load the data required by the query afterwards
What should I do if I want to operate only after all the loads?
There are some complexities here that make it so that I don't suggest trying to model it the way you're thinking of it
its possible to ask for different loads when calling
i.e
your_action(..., load: [roles: Ash.Query.filter(Role, active == true)])
Thats why we model it this way
your hooks should be "pure" 😄
So what you can do is: