Commit d0d6a021 by Eli

Real deletion

parent e76e94e4
......@@ -34,7 +34,9 @@ end
class ActiveRecord::Base
def self.acts_as_paranoid
self.send(:include, Paranoia)
alias_method :destroy!, :destroy
alias_method :delete!, :delete
include Paranoia
default_scope :conditions => { :deleted_at => nil }
end
......
......@@ -113,6 +113,22 @@ class ParanoiaTest < Test::Unit::TestCase
assert_equal false, model.destroyed?
end
def test_real_destroy
model = ParanoidModel.new
model.save
model.destroy!
assert_equal false, ParanoidModel.unscoped.exists?(model.id)
end
def test_real_delete
model = ParanoidModel.new
model.save
model.delete!
assert_equal false, ParanoidModel.unscoped.exists?(model.id)
end
private
def get_featureful_model
......
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