aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2008-03-13 03:06:51 +0000
committerRick Olson <technoweenie@gmail.com>2008-03-13 03:06:51 +0000
commit7750afc4c1b6873bf1ee50ca386b9714430be618 (patch)
treeb26252b2cd340fa7848a73990f5c1958cc395568 /activerecord/lib
parentdd665ff9679514e354336bb183a9b40ad17145fb (diff)
downloadrails-7750afc4c1b6873bf1ee50ca386b9714430be618.tar.gz
rails-7750afc4c1b6873bf1ee50ca386b9714430be618.tar.bz2
rails-7750afc4c1b6873bf1ee50ca386b9714430be618.zip
Ensure that ActiveRecord::Calculations disambiguates field names with the table name. Closes #11027 [cavalle]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9018 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/calculations.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb
index c8c8d42def..fc61a221a1 100644
--- a/activerecord/lib/active_record/calculations.rb
+++ b/activerecord/lib/active_record/calculations.rb
@@ -155,6 +155,7 @@ module ActiveRecord
scope = scope(:find)
merged_includes = merge_includes(scope ? scope[:include] : [], options[:include])
aggregate_alias = column_alias_for(operation, column_name)
+ column_name = "#{connection.quote_table_name(table_name)}.#{column_name}" unless column_name == "*" || column_name.to_s.include?('.')
if operation == 'count'
if merged_includes.any?