Permalink
Browse files

stop exposing the underlying alias datastructure

  • Loading branch information...
1 parent b9d9859 commit 5cba5530ac5df837c55e93c85a3548667f1a9f14 @tenderlove tenderlove committed Jul 2, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 activerecord/lib/active_record/relation/calculations.rb
@@ -91,8 +91,8 @@ def sum(*args)
#
# Person.sum("2 * age")
def calculate(operation, column_name, options = {})
- if column_name.is_a?(Symbol) && attribute_aliases.key?(column_name.to_s)
- column_name = attribute_aliases[column_name.to_s].to_sym
+ if column_name.is_a?(Symbol) && attribute_alias?(column_name)
+ column_name = attribute_alias(column_name).to_sym
end
if has_include?(column_name)
@@ -138,8 +138,8 @@ def calculate(operation, column_name, options = {})
def pluck(*column_names)
column_names.map! do |column_name|
if column_name.is_a?(Symbol)
- if attribute_aliases.key?(column_name.to_s)
- column_name = attribute_aliases[column_name.to_s].to_sym
+ if attribute_alias?(column_name)
+ column_name = attribute_alias(column_name).to_sym
end
if self.columns_hash.key?(column_name.to_s)

0 comments on commit 5cba553

Please sign in to comment.