aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-02-08 17:22:23 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-02-09 08:32:43 -0800
commited6e09c1b181b000d8f409305ddce27fca571674 (patch)
treea9d9714990d580ccd234678f3e13840521892818 /activemodel/lib
parente6369bc9e97d0f1e5583725cd9f684bbe4fca3e1 (diff)
downloadrails-ed6e09c1b181b000d8f409305ddce27fca571674.tar.gz
rails-ed6e09c1b181b000d8f409305ddce27fca571674.tar.bz2
rails-ed6e09c1b181b000d8f409305ddce27fca571674.zip
use 1 call to concat rather than calling << n times
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/errors.rb8
1 files 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