diff options
author | Joshua Cody <josh@joshuacody.net> | 2014-07-31 07:49:57 -0500 |
---|---|---|
committer | Joshua Cody <josh@joshuacody.net> | 2014-07-31 07:49:57 -0500 |
commit | 712c002af51700d128eb45996687600bb20c75a7 (patch) | |
tree | 4caf67fe5b75c6925cf3cb80b6a19f109d18a4a8 /lib | |
parent | bb8416d0943f3e797d572d127a2d74103761d947 (diff) | |
download | rails-712c002af51700d128eb45996687600bb20c75a7.tar.gz rails-712c002af51700d128eb45996687600bb20c75a7.tar.bz2 rails-712c002af51700d128eb45996687600bb20c75a7.zip |
Remove default aliases from aggregate functions
Diffstat (limited to 'lib')
-rw-r--r-- | lib/arel/expressions.rb | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/lib/arel/expressions.rb b/lib/arel/expressions.rb index 717cf412ee..d40268c292 100644 --- a/lib/arel/expressions.rb +++ b/lib/arel/expressions.rb @@ -4,31 +4,25 @@ module Arel Nodes::Count.new [self], distinct end - def sum(alias_as = "sum_id") - Nodes::Sum.new [self], node_alias(alias_as) + def sum + Nodes::Sum.new [self] end - def maximum(alias_as = "max_id") - Nodes::Max.new [self], node_alias(alias_as) + def maximum + Nodes::Max.new [self] end - def minimum(alias_as = "min_id") - Nodes::Min.new [self], node_alias(alias_as) + def minimum + Nodes::Min.new [self] end - def average(alias_as = "avg_id") - Nodes::Avg.new [self], node_alias(alias_as) + def average + Nodes::Avg.new [self] end def extract field Nodes::Extract.new [self], field end - private - - def node_alias(alias_as) - alias_as.nil? ? nil : Nodes::SqlLiteral.new(alias_as) - end - end end |