From 24ac36be7150f97ac0a61cf7cbe7d212097ef1a6 Mon Sep 17 00:00:00 2001 From: Boris Slobodin Date: Sun, 9 Apr 2017 16:05:13 -0700 Subject: exclude ORDER BY clause for exists? (#28699) --- activerecord/lib/active_record/relation/finder_methods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 14c2ddd85b..a1459c87c6 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -383,7 +383,7 @@ module ActiveRecord end def construct_relation_for_exists(relation, conditions) - relation = relation.except(:select, :distinct)._select!(ONE_AS_ONE).limit!(1) + relation = relation.except(:select, :distinct, :order)._select!(ONE_AS_ONE).limit!(1) case conditions when Array, Hash -- cgit v1.2.3