From 0a352056a4055c170e62a521267f5bc51c6659a0 Mon Sep 17 00:00:00 2001 From: wycats Date: Sat, 27 Mar 2010 03:09:33 -0700 Subject: Fixes a bug where error_messages_for was returning an empty div [#4048 state:resolved] (ht: Geoff Garside) --- actionpack/lib/action_view/helpers/active_model_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib/action_view/helpers') diff --git a/actionpack/lib/action_view/helpers/active_model_helper.rb b/actionpack/lib/action_view/helpers/active_model_helper.rb index bbe8609e91..f0358b5dbe 100644 --- a/actionpack/lib/action_view/helpers/active_model_helper.rb +++ b/actionpack/lib/action_view/helpers/active_model_helper.rb @@ -127,7 +127,7 @@ module ActionView object = convert_to_model(object) if (obj = (object.respond_to?(:errors) ? object : instance_variable_get("@#{object}"))) && - (errors = obj.errors[method]) + (errors = obj.errors[method]).presence content_tag("div", "#{options[:prepend_text]}#{ERB::Util.h(errors.first)}#{options[:append_text]}".html_safe, :class => options[:css_class] -- cgit v1.2.3