From 51d84c1d33ee244edfd02f4a703b852ded087370 Mon Sep 17 00:00:00 2001
From: Aaron Patterson <aaron.patterson@gmail.com>
Date: Wed, 9 Feb 2011 08:42:13 -0800
Subject: we do not need message to be an array

---
 activemodel/lib/active_model/errors.rb | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

(limited to 'activemodel/lib')

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
-- 
cgit v1.2.3