use zip + Hash.[] rather than looping with an index

This commit is contained in:
Aaron Patterson
2010-10-20 15:46:04 -07:00
parent 954bd126ec
commit fb835fc1e2

View File

@@ -988,9 +988,7 @@ module ActiveRecord #:nodoc:
end
def construct_attributes_from_arguments(attribute_names, arguments)
attributes = {}
attribute_names.each_with_index { |name, idx| attributes[name] = arguments[idx] }
attributes
Hash[attribute_names.zip(arguments)]
end
# Similar in purpose to +expand_hash_conditions_for_aggregates+.