From 9fbb2c571b65e0501bf3570a3d49e553a9ae39c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 21 Oct 2009 11:18:36 -0500 Subject: Fix error_messages_for when instance variable names are given. Signed-off-by: Joshua Peek --- activemodel/lib/active_model/translation.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'activemodel/lib/active_model') 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 -- cgit v1.2.3