From ed6e09c1b181b000d8f409305ddce27fca571674 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 8 Feb 2011 17:22:23 -0800 Subject: [PATCH] use 1 call to concat rather than calling << n times --- activemodel/lib/active_model/errors.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index 0dc10e3c7d..ea23073a29 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -228,15 +228,15 @@ module ActiveModel next if messages.empty? if attribute == :base - messages.each {|m| full_messages << m } + full_messages.concat messages else attr_name = attribute.to_s.gsub('.', '_').humanize attr_name = @base.class.human_attribute_name(attribute, :default => attr_name) options = { :default => "%{attribute} %{message}", :attribute => attr_name } - messages.each do |m| - full_messages << I18n.t(:"errors.format", options.merge(:message => m)) - end + full_messages.concat messages.map { |m| + I18n.t(:"errors.format", options.merge(:message => m)) + } end end