Permalink
Browse files

Fix #exists? for AR::Model

  • Loading branch information...
jonleighton committed Dec 23, 2011
1 parent 95795bc commit 1029c511f190fbcf4214fa89118bd7264ef9959c
@@ -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

0 comments on commit 1029c51

Please sign in to comment.