aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/errors.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/lib/active_model/errors.rb')
-rw-r--r--activemodel/lib/active_model/errors.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb
index ad7ed723a1..b9541ca3be 100644
--- a/activemodel/lib/active_model/errors.rb
+++ b/activemodel/lib/active_model/errors.rb
@@ -107,7 +107,12 @@ module ActiveModel
if attribute == :base
messages.each {|m| full_messages << m }
else
- attr_name = @base.class.human_attribute_name(attribute.to_s)
+ if @base.class.respond_to?(:human_attribute_name)
+ attr_name = @base.class.human_attribute_name(attribute.to_s)
+ else
+ attr_name = attribute.to_s.humanize
+ end
+
prefix = attr_name + I18n.t('activerecord.errors.format.separator', :default => ' ')
messages.each do |m|
full_messages << "#{prefix}#{m}"