From 9c1c551f25577c01624b23bc53139c60a4fc451b Mon Sep 17 00:00:00 2001 From: Raimonds Simanovskis Date: Tue, 4 Jan 2011 17:06:33 +0200 Subject: Explicitly select * from has_and_belongs_to_many association tables, simplify exists? query Previous version (after commit 3103296a61709e808aa89c3d37cf22bcdbc5a675) was generating wrong SQL for Oracle when calling exists? method on HABTM association. --- activerecord/lib/active_record/relation/finder_methods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/relation') diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 13f55319a7..8bbc47ab75 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -171,7 +171,7 @@ module ActiveRecord def exists?(id = nil) id = id.id if ActiveRecord::Base === id - relation = select(table[primary_key]).limit(1) + relation = select("1").limit(1) case id when Array, Hash -- cgit v1.2.3