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:
parent
780e8939c0
commit
d1729b917f
1 changed files with 1 additions and 11 deletions
|
@ -60,18 +60,8 @@ module ActiveRecord
|
||||||
@attribute_names = @name.match(self.class.pattern)[1].split('_and_')
|
@attribute_names = @name.match(self.class.pattern)[1].split('_and_')
|
||||||
end
|
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?
|
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
|
end
|
||||||
|
|
||||||
def define
|
def define
|
||||||
|
|
Loading…
Reference in a new issue