提交 0d70f310 编写于 作者: J Jeremy Kemper

Remove dead code from hmt#delete. Closes #11236 [rubyruy]


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8932 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 c6a3a39f
......@@ -83,7 +83,7 @@ def delete(*records)
raise_on_type_mismatch(associate)
raise ActiveRecord::HasManyThroughCantDissociateNewRecords.new(@owner, through) unless associate.respond_to?(:new_record?) && !associate.new_record?
@owner.send(through.name).proxy_target.delete(klass.delete_all(construct_join_attributes(associate)))
klass.delete_all(construct_join_attributes(associate))
@target.delete(associate)
end
end
......
......@@ -505,11 +505,13 @@ def test_delete_associate_when_deleting_from_has_many_through
tag = Tag.create!(:name => 'doomed')
post_thinking = posts(:thinking)
post_thinking.tags << tag
assert_equal(count + 1, post_thinking.taggings(true).size)
assert_equal(count + 1, post_thinking.tags(true).size)
assert_nothing_raised { post_thinking.tags.delete(tag) }
assert_equal(count, post_thinking.tags.size)
assert_equal(count, post_thinking.tags(true).size)
assert_equal(count, post_thinking.taggings(true).size)
assert_equal(tags_before.sort, post_thinking.tags.sort)
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册