Commit d97417a2 by John Hawthorn

Add additional test against polymorphic has_one

To ensure that we are using the association _type in our scope.
parent f63ccc7f
......@@ -671,6 +671,21 @@ class ParanoiaTest < test_framework
assert_equal 1, polymorphic.class.count
end
# Ensure that we're checking parent_type when restoring
def test_missing_restore_recursive_on_polymorphic_has_one_association
parent = ParentModel.create
polymorphic = PolymorphicModel.create(parent_id: parent.id, parent_type: 'ParanoidModel')
parent.destroy
polymorphic.destroy
assert_equal 0, polymorphic.class.count
parent.restore(recursive: true)
assert_equal 0, polymorphic.class.count
end
private
def get_featureful_model
FeaturefulModel.new(:name => "not empty")
......
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