Commit b23c08fe by Ryan Bigg

Add alias 'deleted' to rails4 branch

parent 172efa86
......@@ -14,6 +14,7 @@ module Paranoia
def only_deleted
with_deleted.where.not(deleted_at: nil)
end
alias :deleted :only_deleted
def restore(id)
if id.is_a?(Array)
......
......@@ -82,6 +82,7 @@ class ParanoiaTest < Test::Unit::TestCase
p2.destroy
assert_equal 0, parent1.paranoid_models.count
assert_equal 1, parent1.paranoid_models.only_deleted.count
assert_equal 1, parent1.paranoid_models.deleted.count
p3 = ParanoidModel.create(:parent_model => parent1)
assert_equal 2, parent1.paranoid_models.with_deleted.count
assert_equal [p1,p3], parent1.paranoid_models.with_deleted
......
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