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