diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-08 17:22:23 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-09 08:32:43 -0800 |
commit | ed6e09c1b181b000d8f409305ddce27fca571674 (patch) | |
tree | a9d9714990d580ccd234678f3e13840521892818 /activemodel | |
parent | e6369bc9e97d0f1e5583725cd9f684bbe4fca3e1 (diff) | |
download | rails-ed6e09c1b181b000d8f409305ddce27fca571674.tar.gz rails-ed6e09c1b181b000d8f409305ddce27fca571674.tar.bz2 rails-ed6e09c1b181b000d8f409305ddce27fca571674.zip |
use 1 call to concat rather than calling << n times
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/lib/active_model/errors.rb | 8 |
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 |