aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-02-09 08:42:13 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-02-09 08:42:13 -0800
commit51d84c1d33ee244edfd02f4a703b852ded087370 (patch)
treeb00c08dcaf9bdd8424e9128d5758b274adad71b2 /activemodel
parent56fb3b1594d97fa00dd8d8d95f1d5bf7c30380ee (diff)
downloadrails-51d84c1d33ee244edfd02f4a703b852ded087370.tar.gz
rails-51d84c1d33ee244edfd02f4a703b852ded087370.tar.bz2
rails-51d84c1d33ee244edfd02f4a703b852ded087370.zip
we do not need message to be an array
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/errors.rb17
1 files changed, 8 insertions, 9 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb
index 04d996f78c..003c94a409 100644
--- a/activemodel/lib/active_model/errors.rb
+++ b/activemodel/lib/active_model/errors.rb
@@ -245,21 +245,20 @@ module ActiveModel
# company.errors.full_messages # =>
# ["Name is too short (minimum is 5 characters)", "Name can't be blank", "Address can't be blank"]
def full_messages
- map { |attribute, messages|
- messages = Array.wrap(messages)
-
+ map { |attribute, message|
if attribute == :base
- messages
+ message
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.map { |m|
- I18n.t(:"errors.format", options.merge(:message => m))
- }
+ I18n.t(:"errors.format", {
+ :default => "%{attribute} %{message}",
+ :attribute => attr_name,
+ :message => message
+ })
end
- }.flatten
+ }
end
# Translates an error message in its default scope