diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-29 12:23:03 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-29 12:23:03 -0700 |
commit | 4d271c96b9e090a3fa75797f82e8d1d423a009c8 (patch) | |
tree | e84b2f9807779f5d8df88f5f1f8001747fa420f1 /lib/arel/engines/sql/relations/compiler.rb | |
parent | 49e4dcbd7407da096506f387c73e265b15751730 (diff) | |
download | rails-4d271c96b9e090a3fa75797f82e8d1d423a009c8.tar.gz rails-4d271c96b9e090a3fa75797f82e8d1d423a009c8.tar.bz2 rails-4d271c96b9e090a3fa75797f82e8d1d423a009c8.zip |
fewer function calls
Diffstat (limited to 'lib/arel/engines/sql/relations/compiler.rb')
-rw-r--r-- | lib/arel/engines/sql/relations/compiler.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/arel/engines/sql/relations/compiler.rb b/lib/arel/engines/sql/relations/compiler.rb index ad68a7ea2e..43d0e1aeb9 100644 --- a/lib/arel/engines/sql/relations/compiler.rb +++ b/lib/arel/engines/sql/relations/compiler.rb @@ -13,7 +13,8 @@ module Arel end def select_sql - if relation.projections.first.is_a?(Count) && relation.projections.size == 1 && + projections = @relation.projections + if projections.first.is_a?(Count) && projections.size == 1 && (relation.taken.present? || relation.wheres.present?) && relation.joins(self).blank? subquery = [ "SELECT 1 FROM #{relation.from_clauses}", build_clauses |