aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/finder_test.rb
diff options
context:
space:
mode:
authorPeter Marklund <peter_marklund@fastmail.fm>2009-05-14 09:30:16 +0200
committerMichael Koziarski <michael@koziarski.com>2009-05-14 20:42:00 +1200
commitafcbdfc15f919a470e4cfca97fb0084eebd2ab1f (patch)
tree2a05aa38fb247d8c1abc92a3c5926d9a3fdacc79 /activerecord/test/cases/finder_test.rb
parent49a84ff69ca4fc4db821ca3b5a5926d07832c845 (diff)
downloadrails-afcbdfc15f919a470e4cfca97fb0084eebd2ab1f.tar.gz
rails-afcbdfc15f919a470e4cfca97fb0084eebd2ab1f.tar.bz2
rails-afcbdfc15f919a470e4cfca97fb0084eebd2ab1f.zip
Changed ActiveRecord::Base#exists? to invoke find_initial so that it is compatible with, and doesn't lose, :include scopes (references to eager loaded tables)
Signed-off-by: Michael Koziarski <michael@koziarski.com> [#2543 state:committed]
Diffstat (limited to 'activerecord/test/cases/finder_test.rb')
-rw-r--r--activerecord/test/cases/finder_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb
index ad4588db69..d0d7094e30 100644
--- a/activerecord/test/cases/finder_test.rb
+++ b/activerecord/test/cases/finder_test.rb
@@ -119,6 +119,12 @@ class FinderTest < ActiveRecord::TestCase
Address.new(existing_address.street + "1", existing_address.city, existing_address.country))
end
+ def test_exists_with_scoped_include
+ Developer.with_scope(:find => { :include => :projects, :order => "projects.name" }) do
+ assert Developer.exists?
+ end
+ end
+
def test_find_by_array_of_one_id
assert_kind_of(Array, Topic.find([ 1 ]))
assert_equal(1, Topic.find([ 1 ]).length)