Skip to content

Commit d960e5e

Browse files
committed
.really_destroy! should not destroy has_many :through records
rubysherpas#466
1 parent ccf85e5 commit d960e5e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/paranoia.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ def really_destroy!
141141
run_callbacks(:real_destroy) do
142142
@_disable_counter_cache = paranoia_destroyed?
143143
dependent_reflections = self.class.reflections.select do |name, reflection|
144-
reflection.options[:dependent] == :destroy
144+
reflection.options[:dependent] == :destroy &&
145+
reflection.options[:through].blank?
145146
end
146147
if dependent_reflections.any?
147148
dependent_reflections.each do |name, reflection|

0 commit comments

Comments
 (0)