Filtering inside a load
Hopefully an easy one. I have a code interface that I'm calling inside a calculation module like this:
Assuming I pass a
graduation_year argument to the calculation (and access it as the fourth param on the function), how can I filter the users that are being loaded?8 Replies
You can also supply a inital query for the load
where is
changeset coming from?ah sorry, I mixed up changes and calculations it should be
context should be the 3. argument to the calculate function your are calling this private function from
@barnabasj Is this some sort of annonymous calculation or is it a filter applied to the relationship users?
If possible I want to apply a filter to loading of a relationship, inside the load callback for a calculation.
it passes an initial query that is than used to build the query for the relationship
Any resource where I can read more about this?
Or where do I find the implementation of this?
https://hexdocs.pm/ash/relationships.html#more-complex-data-loading it's mentioned in the guide here
Neat! I totally missed this! Much appreciated 🙏