Commit ef47606e by Martin Sereinig Committed by Ryan Bigg

touch_paranoia_column before really_destroy!-ing a record in rails 4.1.x.…

touch_paranoia_column before really_destroy!-ing a record in rails 4.1.x. reloading already really_destroy!-ed associations is needed, otherwise super.destroy! will try to destroy these asociations (because they still exist on the activerecord object, but are already removed from the database)

Fixes #143
parent cff12983
......@@ -153,8 +153,10 @@ class ActiveRecord::Base
# Paranoid models will have this method, non-paranoid models will not
associated_records = associated_records.with_deleted if associated_records.respond_to?(:with_deleted)
associated_records.each(&:really_destroy!)
self.send(name).reload
end
end
touch_paranoia_column if ActiveRecord::VERSION::STRING >= "4.1"
destroy!
end
......
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