Commit c9227381 by Ryan Bigg

Use an unscoped call on associations within really_destroy to REALLY DESTROY ALL THE THINGS

💣
parent 4f268326
......@@ -135,7 +135,7 @@ class ActiveRecord::Base
end
if dependent_reflections.any?
dependent_reflections.each do |name, _|
self.send(name).each(&:really_destroy!)
self.send(name).unscoped.each(&:really_destroy!)
end
end
destroy!
......
......@@ -301,6 +301,14 @@ class ParanoiaTest < test_framework
refute RelatedModel.unscoped.exists?(child.id)
end
def test_real_destroy_dependent_destroy_after_normal_destroy
parent = ParentModel.create
child = parent.very_related_models.create
parent.destroy
parent.really_destroy!
refute RelatedModel.unscoped.exists?(child.id)
end
if ActiveRecord::VERSION::STRING < "4.1"
def test_real_destroy
model = ParanoidModel.new
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment