diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-11-14 17:17:23 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-11-15 13:42:50 -0800 |
commit | f77beac8a66a15b1e6f100e4134c79338ee9756b (patch) | |
tree | c7239d35d153957ada23c0ab5f20e08cbd29f237 /activerecord | |
parent | d5a8bdb2e21bc9b22241b9e2b604e88b76398339 (diff) | |
download | rails-f77beac8a66a15b1e6f100e4134c79338ee9756b.tar.gz rails-f77beac8a66a15b1e6f100e4134c79338ee9756b.tar.bz2 rails-f77beac8a66a15b1e6f100e4134c79338ee9756b.zip |
stop passing *args to generate aliases
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/relation/calculations.rb | 6 |
1 files changed, 2 insertions, 4 deletions
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! |