提交 784177ae 编写于 作者: A Aaron Patterson

only call `column_methods_hash` once, use array math for faster test of existence

上级 7f444a3d
......@@ -991,19 +991,18 @@ def expand_attribute_names_for_aggregates(attribute_names)
attribute_names.each do |attribute_name|
unless (aggregation = reflect_on_aggregation(attribute_name.to_sym)).nil?
aggregate_mapping(aggregation).each do |field_attr, aggregate_attr|
expanded_attribute_names << field_attr
expanded_attribute_names << field_attr.to_sym
end
else
expanded_attribute_names << attribute_name
expanded_attribute_names << attribute_name.to_sym
end
end
expanded_attribute_names
end
def all_attributes_exists?(attribute_names)
expand_attribute_names_for_aggregates(attribute_names).all? { |name|
column_methods_hash.include?(name.to_sym)
}
(expand_attribute_names_for_aggregates(attribute_names) -
column_methods_hash.keys).empty?
end
protected
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册