-
Notifications
You must be signed in to change notification settings - Fork 531
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
[Rails 5] joins calls ignore with_deleted scope #355
Comments
I'm seeing similar behavior here on paranoia (2.2.0.pre) with rails (5.0.0.1)
|
Seems to me that unscope(where: :deleted_at) does not remove the clause in associations. From the examples of unscope I have seen, It seems that this does actually be a rails bug. |
Is this a dupe of #330 ? Could both of these issues have been resolved by rails/rails#18109 which was merged a couple days ago? |
@gkop |
To give more context:
This works as expected: This doesn't remove the deleted_at where clause from identifiable, person and company: Results in the following query: |
My mistake, I can still replicate too. |
So, I do actually think this is a Rails specific bug, not paranoia specific. Unscope doesn't unscope stuff from joined associations it seems. |
Should be fixed in rails/rails@5c71000 |
I'm adding the with_deleted condition to a belongs_to association as so:
This works properly when directly loading
subject
from aSession
instance, but when executing a joins call, thedeleted_at IS NULL
is still included in the query:I don't think that is the intended behavior, but if it is, it should probably be noted in the readme.
I don't believe this is a Rails bug, as I tried replacing the condition clause with something innocuous and the resulting sql output included the condition:
I'm running paranoia v2.2.0.pre w/Rails 5.0.0.
The text was updated successfully, but these errors were encountered: