Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Associations are not checking for soft delete #4

Open
D4no0 opened this issue Sep 4, 2019 · 0 comments
Open

Associations are not checking for soft delete #4

D4no0 opened this issue Sep 4, 2019 · 0 comments

Comments

@D4no0
Copy link
Contributor

D4no0 commented Sep 4, 2019

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant