aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-10-20 15:46:04 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-10-20 15:46:04 -0700
commitfb835fc1e2d915deed2a1a7bd6d2e14d526897df (patch)
treec89777b5ca161eb7a86f2c7411ae130be079ea53 /activerecord
parent954bd126eca03c666996520a2d996e32c772487e (diff)
downloadrails-fb835fc1e2d915deed2a1a7bd6d2e14d526897df.tar.gz
rails-fb835fc1e2d915deed2a1a7bd6d2e14d526897df.tar.bz2
rails-fb835fc1e2d915deed2a1a7bd6d2e14d526897df.zip
use zip + Hash.[] rather than looping with an index
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/base.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index dd50e1658a..315598fc4b 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -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+.