diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-29 12:14:52 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-07-29 12:14:52 -0700 |
commit | 49e4dcbd7407da096506f387c73e265b15751730 (patch) | |
tree | ca5701b6281b28b2ea46a33af6df7a37f9757f6a /lib/arel/engines/sql/relations/compiler.rb | |
parent | f87c8398d95f3f4b162a3a78299489189d7a0a45 (diff) | |
download | rails-49e4dcbd7407da096506f387c73e265b15751730.tar.gz rails-49e4dcbd7407da096506f387c73e265b15751730.tar.bz2 rails-49e4dcbd7407da096506f387c73e265b15751730.zip |
PERF: avoid *args
Diffstat (limited to 'lib/arel/engines/sql/relations/compiler.rb')
-rw-r--r-- | lib/arel/engines/sql/relations/compiler.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/arel/engines/sql/relations/compiler.rb b/lib/arel/engines/sql/relations/compiler.rb index 2fb4c7841e..ad68a7ea2e 100644 --- a/lib/arel/engines/sql/relations/compiler.rb +++ b/lib/arel/engines/sql/relations/compiler.rb @@ -15,7 +15,9 @@ module Arel def select_sql if relation.projections.first.is_a?(Count) && relation.projections.size == 1 && (relation.taken.present? || relation.wheres.present?) && relation.joins(self).blank? - subquery = build_query("SELECT 1 FROM #{relation.from_clauses}", build_clauses) + subquery = [ + "SELECT 1 FROM #{relation.from_clauses}", build_clauses + ].join ' ' query = "SELECT COUNT(*) AS count_id FROM (#{subquery}) AS subquery" else query = [ |