diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2012-05-10 23:16:40 +0100 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2012-05-10 23:22:54 +0100 |
commit | 62f098dddf55a36e15c94a60b29c3c280b219cce (patch) | |
tree | ea1d41ea28d9201b3a36c52c8fa7efcec27e3465 /activerecord/test/cases | |
parent | 66e338aa98d8ccdbeb9ca261886edd1d0c9747b6 (diff) | |
download | rails-62f098dddf55a36e15c94a60b29c3c280b219cce.tar.gz rails-62f098dddf55a36e15c94a60b29c3c280b219cce.tar.bz2 rails-62f098dddf55a36e15c94a60b29c3c280b219cce.zip |
Return false for exists? with new records - fixes #6199.
(cherry picked from commit fa21b73ebb8339ad388f149c817c433b6254d490)
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/finder_test.rb | 1 | ||||
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index c72a9dcb17..9bf9fe7d82 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -32,6 +32,7 @@ class FinderTest < ActiveRecord::TestCase assert Topic.exists?(:author_name => "Mary", :approved => true) assert Topic.exists?(["parent_id = ?", 1]) assert !Topic.exists?(45) + assert !Topic.exists?(Topic.new) begin assert !Topic.exists?("foo") diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index fc39e67e3d..7639585649 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -599,6 +599,7 @@ class RelationTest < ActiveRecord::TestCase assert ! davids.exists?(authors(:mary).id) assert ! davids.exists?("42") assert ! davids.exists?(42) + assert ! davids.exists?(davids.new) fake = Author.where(:name => 'fake author') assert ! fake.exists? |