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

ActiveRecord queries with includes now respect :with_deleted => true #30

Closed
wants to merge 29 commits into from

Conversation

pelargir
Copy link
Contributor

This fixes issue #17 by ensuring :with_deleted => true is respected when using #includes and #joins in association queries. Hat tip to @tkupari for the original fix in goncalossilva/acts_as_paranoid#115

tkupari and others added 27 commits February 14, 2015 14:11
The values of the result hash are all reflection objects. Adding a
boolean there breaks stuff.
Remove #unscoped to avoid clearing the where_values prematurely.
The dependent destroy callback mechanism in Rails calls destroy! instead
of destroy for has_many associations. With the existing implementation
of acts_as_paranoid, this would unintentionally cause dependent objects
to be hard-destroyed. This change makes destroy and destroy! identical,
and adds a separate destroy_fully! method for full destroy.
By merging the scope, the original code would re-apply the default
non-deleted scope, causing the scope to always return zero records. Use
regular scope chaining instead.
This is to avoid conflict with minitest versions required by the
different versions of Rails.
@zzak
Copy link
Contributor

zzak commented Oct 28, 2015

@pelargir Could you rebase this? Thanks!

@pelargir
Copy link
Contributor Author

I couldn't get it to merge properly so I created pull request #37 instead. Please use that.

@pelargir pelargir closed this Oct 30, 2015
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

Successfully merging this pull request may close these issues.

5 participants