From f77beac8a66a15b1e6f100e4134c79338ee9756b Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 14 Nov 2012 17:17:23 -0800 Subject: stop passing *args to generate aliases --- activerecord/lib/active_record/relation/calculations.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'activerecord/lib/active_record/relation/calculations.rb') diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index e801cc4e65..83cbbc1c1d 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -334,10 +334,8 @@ module ActiveRecord # column_alias_for("count(distinct users.id)") # => "count_distinct_users_id" # column_alias_for("count(*)") # => "count_all" # column_alias_for("count", "id") # => "count_id" - def column_alias_for(*keys) - keys.map! {|k| k.respond_to?(:to_sql) ? k.to_sql : k} - table_name = keys.join(' ') - table_name.downcase! + def column_alias_for(keys) + table_name = keys.to_s.downcase table_name.gsub!(/\*/, 'all') table_name.gsub!(/\W+/, ' ') table_name.strip! -- cgit v1.2.3