Our issue is that one of our model's changeset validations is dependent on an attribute of a child association. We should not be able to update the record if a boolean value is set to true in the child association.
However, we are not guaranteed that the changeset will always be called with a struct that preloads the association that we need. We want to avoid making a Repo.preload call in the model as much as possible because of separation of concerns, and we know this may set a precedent for poor coding practices in the future.
We have considered checking if the association is preloaded in the changeset, and throwing an error if it is not. However, we want to avoid this solution as much as possible.
I would greatly appreciate it if anybody knows of a cleaner solution for us to use.