aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-01-05 09:23:25 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-01-05 09:23:30 -0800
commit35a225535f38df551a1399b596622f3e3a0bbfbe (patch)
tree69059d0662caf56a1907c490ee24a26bd4cba535
parent8de5595e4d101a53f33ae8c48837855d8594f320 (diff)
downloadrails-35a225535f38df551a1399b596622f3e3a0bbfbe.tar.gz
rails-35a225535f38df551a1399b596622f3e3a0bbfbe.tar.bz2
rails-35a225535f38df551a1399b596622f3e3a0bbfbe.zip
use arel to construct AST rather than generate strings
-rw-r--r--activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
index a4194defc2..f3b1c9de3f 100644
--- a/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
+++ b/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
@@ -83,8 +83,9 @@ module ActiveRecord
super.merge(
:joins => construct_joins,
:readonly => ambiguous_select?(@reflection.options[:select]),
- :select => @reflection.options[:select] ||
- Arel.sql("#{@reflection.quoted_table_name}.*, #{@owner.connection.quote_table_name @reflection.options[:join_table]}.*")
+ :select => @reflection.options[:select] || [
+ @reflection.klass.arel_table[Arel.star],
+ join_table[Arel.star]]
)
end