diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-02-20 18:55:56 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-02-20 18:55:56 +0000 |
commit | b9e95e7a708501b62a2a886a544b97dbf41838b8 (patch) | |
tree | 1f1ba7832c02e1a40ddbaa361b433e1a9073e4c5 /app/helpers | |
parent | 33e7ae96adcb0282ee181560bb88c0765a8ee149 (diff) | |
download | redmine-b9e95e7a708501b62a2a886a544b97dbf41838b8.tar.gz redmine-b9e95e7a708501b62a2a886a544b97dbf41838b8.zip |
Fixes "too few arguments" error on activerecord error translation (#2626).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2486 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_helper.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2872c14a1..5b63ecd5a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -573,11 +573,11 @@ module ApplicationHelper full_messages = [] object.errors.each do |attr, msg| next if msg.nil? - msg = msg.first if msg.is_a? Array + msg = [msg] unless msg.is_a?(Array) if attr == "base" - full_messages << l(msg) + full_messages << l(*msg) else - full_messages << "« " + (l_has_string?("field_" + attr) ? l("field_" + attr) : object.class.human_attribute_name(attr)) + " » " + l(msg) unless attr == "custom_values" + full_messages << "« " + (l_has_string?("field_" + attr) ? l("field_" + attr) : object.class.human_attribute_name(attr)) + " » " + l(*msg) unless attr == "custom_values" end end # retrieve custom values error messages @@ -585,8 +585,8 @@ module ApplicationHelper object.custom_values.each do |v| v.errors.each do |attr, msg| next if msg.nil? - msg = msg.first if msg.is_a? Array - full_messages << "« " + v.custom_field.name + " » " + l(msg) + msg = [msg] unless msg.is_a?(Array) + full_messages << "« " + v.custom_field.name + " » " + l(*msg) end end end |