1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

use 1 call to concat rather than calling << n times

This commit is contained in:
Aaron Patterson 2011-02-08 17:22:23 -08:00
parent e6369bc9e9
commit ed6e09c1b1

View file

@ -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