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:
parent
e6369bc9e9
commit
ed6e09c1b1
1 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue