aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-03-19 23:45:08 +0000
committerPratik Naik <pratiknaik@gmail.com>2009-03-19 23:45:08 +0000
commit77acfefedf80a2c30f8a0f71b5b6d33d1b9fd144 (patch)
tree8ee169fa9dc6cd1dcc9e221e196dd0665234d78f /activemodel/lib
parent638333b7a17234ed65b2e8b0bee3d9b533446803 (diff)
downloadrails-77acfefedf80a2c30f8a0f71b5b6d33d1b9fd144.tar.gz
rails-77acfefedf80a2c30f8a0f71b5b6d33d1b9fd144.tar.bz2
rails-77acfefedf80a2c30f8a0f71b5b6d33d1b9fd144.zip
Make Active Resource use ActiveModel::Errors
Diffstat (limited to 'activemodel/lib')
-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}"