1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

actually don't need to expand the aggregates at all

This commit is contained in:
Jon Leighton 2012-05-03 00:54:16 +01:00
parent 780e8939c0
commit d1729b917f

View file

@ -60,18 +60,8 @@ module ActiveRecord
@attribute_names = @name.match(self.class.pattern)[1].split('_and_')
end
def expand_attribute_names_for_aggregates
attribute_names.map do |attribute_name|
if aggregation = model.reflect_on_aggregation(attribute_name.to_sym)
aggregation.mapping.map(&:first)
else
attribute_name
end
end.flatten
end
def valid?
(expand_attribute_names_for_aggregates - model.column_names).empty?
attribute_names.all? { |name| model.columns_hash[name] || model.reflect_on_aggregation(name.to_sym) }
end
def define