aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/lib/active_resource
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-10-03 15:03:59 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2010-10-03 15:03:59 -0200
commit42fad8c82b3ba6f86c84f06645cc1e39a8a776dd (patch)
treee2aafeb206df08993d8279846963215800598a5b /activeresource/lib/active_resource
parent49203126430c6dbaf9ce47c21c58c4081fb53e82 (diff)
downloadrails-42fad8c82b3ba6f86c84f06645cc1e39a8a776dd.tar.gz
rails-42fad8c82b3ba6f86c84f06645cc1e39a8a776dd.tar.bz2
rails-42fad8c82b3ba6f86c84f06645cc1e39a8a776dd.zip
PERF: more changes from inject({}) to Hash + map
Diffstat (limited to 'activeresource/lib/active_resource')
-rw-r--r--activeresource/lib/active_resource/validations.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activeresource/lib/active_resource/validations.rb b/activeresource/lib/active_resource/validations.rb
index d3b19ee560..a373e53f11 100644
--- a/activeresource/lib/active_resource/validations.rb
+++ b/activeresource/lib/active_resource/validations.rb
@@ -13,7 +13,7 @@ module ActiveResource
# or not (by passing true)
def from_array(messages, save_cache = false)
clear unless save_cache
- humanized_attributes = @base.attributes.keys.inject({}) { |h, attr_name| h.update(attr_name.humanize => attr_name) }
+ humanized_attributes = Hash[@base.attributes.keys.map { |attr_name| [attr_name.humanize, attr_name] }]
messages.each do |message|
attr_message = humanized_attributes.keys.detect do |attr_name|
if message[0, attr_name.size + 1] == "#{attr_name} "