Skip to content

Commit

Permalink
.really_destroy! should not destroy has_many :through records
Browse files Browse the repository at this point in the history
  • Loading branch information
atd committed Mar 8, 2019
1 parent ccf85e5 commit d960e5e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/paranoia.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ def really_destroy!
run_callbacks(:real_destroy) do
@_disable_counter_cache = paranoia_destroyed?
dependent_reflections = self.class.reflections.select do |name, reflection|
reflection.options[:dependent] == :destroy
reflection.options[:dependent] == :destroy &&
reflection.options[:through].blank?
end
if dependent_reflections.any?
dependent_reflections.each do |name, reflection|
Expand Down

0 comments on commit d960e5e

Please sign in to comment.