aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2011-11-09 04:46:11 +0900
committerAkira Matsuda <ronnie@dio.jp>2011-11-09 04:51:11 +0900
commit74c6e80cabd8e3b7751fc3a32c9ad95c1780054b (patch)
tree515d82113e061b166d26cfc442f78634cbc512cb /activerecord/test/cases
parent5b21bfa84862807d62b297de76805de8afcee511 (diff)
downloadrails-74c6e80cabd8e3b7751fc3a32c9ad95c1780054b.tar.gz
rails-74c6e80cabd8e3b7751fc3a32c9ad95c1780054b.tar.bz2
rails-74c6e80cabd8e3b7751fc3a32c9ad95c1780054b.zip
exclude ORDER BY clause when querying Relation#exists?
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/finder_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb
index 3088ab012f..69754d23b9 100644
--- a/activerecord/test/cases/finder_test.rb
+++ b/activerecord/test/cases/finder_test.rb
@@ -57,6 +57,11 @@ class FinderTest < ActiveRecord::TestCase
assert Topic.first.replies.exists?
end
+ # ensures +exists?+ runs valid SQL by excluding order value
+ def test_exists_with_order
+ assert Topic.order(:id).uniq.exists?
+ end
+
def test_does_not_exist_with_empty_table_and_no_args_given
Topic.delete_all
assert !Topic.exists?