aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2009-10-21 11:18:36 -0500
committerJoshua Peek <josh@joshpeek.com>2009-10-21 11:18:36 -0500
commit9fbb2c571b65e0501bf3570a3d49e553a9ae39c1 (patch)
treef67ce04a5ff9f3b32be8c1b060c4991d67ca687a /activemodel/lib
parente714b499cc1f7ebc84f8d0e96607b79e60f2828d (diff)
downloadrails-9fbb2c571b65e0501bf3570a3d49e553a9ae39c1.tar.gz
rails-9fbb2c571b65e0501bf3570a3d49e553a9ae39c1.tar.bz2
rails-9fbb2c571b65e0501bf3570a3d49e553a9ae39c1.zip
Fix error_messages_for when instance variable names are given.
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/translation.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/translation.rb b/activemodel/lib/active_model/translation.rb
index dc11198c66..2ad8ca9dea 100644
--- a/activemodel/lib/active_model/translation.rb
+++ b/activemodel/lib/active_model/translation.rb
@@ -45,6 +45,9 @@ module ActiveModel
# it will underscore then humanize the class name (BlogPost.human_name #=> "Blog post").
# Specify +options+ with additional translating options.
def human(options={})
+ return @human unless @klass.respond_to?(:lookup_ancestors) &&
+ @klass.respond_to?(:i18n_scope)
+
defaults = @klass.lookup_ancestors.map do |klass|
klass.model_name.underscore.to_sym
end