diff options
author | José Valim <jose.valim@gmail.com> | 2009-12-31 13:44:15 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-02 22:27:02 +0100 |
commit | 5fdd0e80a4db778268e80435b471090cb14f7229 (patch) | |
tree | 3331da25671e00d29ca86d4c24753da6b30031a3 /activemodel/lib | |
parent | dcafe995bfe51e53dd04607956be9b54073e9cb6 (diff) | |
download | rails-5fdd0e80a4db778268e80435b471090cb14f7229.tar.gz rails-5fdd0e80a4db778268e80435b471090cb14f7229.tar.bz2 rails-5fdd0e80a4db778268e80435b471090cb14f7229.zip |
Be sure to convert namespaced names to we have 'Parrots name' instead of 'Parrots.name' in error messages.
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/errors.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index e8bb62953d..262a1ef22b 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -97,13 +97,14 @@ module ActiveModel full_messages = [] each do |attribute, messages| - messages = Array.wrap(messages) + messages = Array(messages) next if messages.empty? if attribute == :base messages.each {|m| full_messages << m } else - attr_name = @base.class.human_attribute_name(attribute) + attr_name = attribute.to_s.gsub('.', '_').humanize + attr_name = @base.class.human_attribute_name(attribute, :default => attr_name) options = { :default => ' ', :scope => @base.class.i18n_scope } prefix = attr_name + I18n.t(:"errors.format.separator", options) |