Commit f4c49b51 by Ryan Bigg

Fix regression in fb9c903a where objects were no longer frozen upon delete

parent 7439417e
......@@ -10,6 +10,7 @@ module Paranoia
def destroy
_run_destroy_callbacks
self.update_attribute(:deleted_at, Time.now) if !deleted? && persisted?
freeze
end
alias :delete :destroy
......
......@@ -37,6 +37,7 @@ class ParanoiaTest < Test::Unit::TestCase
model.delete
assert_equal true, model.deleted_at.nil?
assert model.frozen?
assert_equal 0, model.class.count
assert_equal 0, model.class.unscoped.count
......@@ -50,6 +51,7 @@ class ParanoiaTest < Test::Unit::TestCase
model.delete
assert_equal false, model.deleted_at.nil?
assert model.frozen?
assert_equal 0, model.class.count
assert_equal 1, model.class.unscoped.count
......
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