When an association is used in combination with preload, the paranoid repo is not checking whether the field deleted_at is not null.
The only workaround for this current problem is to use a query in preload:
UserRepo.get_users!(1) |> Paranoid.preload(role: Query.from(r in Role, where: is_nil(r.deleted_at)))
Taking a look at the library code the behavior of the preload is not overridden and the default one is used:
def preload(struct_or_structs_or_nil, preloads, opts \\ []) do
unquote(repo)
|> apply(:preload, [struct_or_structs_or_nil, preloads, opts])
end
When an association is used in combination with preload, the paranoid repo is not checking whether the field deleted_at is not null.
The only workaround for this current problem is to use a query in preload:
UserRepo.get_users!(1) |> Paranoid.preload(role: Query.from(r in Role, where: is_nil(r.deleted_at)))Taking a look at the library code the behavior of the preload is not overridden and the default one is used: