提交 1029c511 编写于 作者: J Jon Leighton

Fix #exists? for AR::Model

上级 95795bcb
......@@ -187,7 +187,7 @@ def all(*args)
def exists?(id = false)
return false if id.nil?
id = id.id if ActiveRecord::Base === id
id = id.id if ActiveRecord::Model === id
join_dependency = construct_join_dependency_for_association_find
relation = construct_relation_for_association_find(join_dependency)
......
......@@ -18,6 +18,11 @@ def test_inherited_model
def test_generated_feature_methods
assert Teapot < Teapot::GeneratedFeatureMethods
end
def test_exists
t = Teapot.create!(:name => "Ronnie Kemper")
assert Teapot.exists?(t)
end
end
class InclusionUnitTest < ActiveRecord::TestCase
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册