diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-03-19 23:45:08 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-03-19 23:45:08 +0000 |
commit | 77acfefedf80a2c30f8a0f71b5b6d33d1b9fd144 (patch) | |
tree | 8ee169fa9dc6cd1dcc9e221e196dd0665234d78f /activemodel | |
parent | 638333b7a17234ed65b2e8b0bee3d9b533446803 (diff) | |
download | rails-77acfefedf80a2c30f8a0f71b5b6d33d1b9fd144.tar.gz rails-77acfefedf80a2c30f8a0f71b5b6d33d1b9fd144.tar.bz2 rails-77acfefedf80a2c30f8a0f71b5b6d33d1b9fd144.zip |
Make Active Resource use ActiveModel::Errors
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/lib/active_model/errors.rb | 7 |
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}" |