error_message_on broken?

Ingo Weiss wrote:

Hi,

in my app, using the error_message_on form helper like this:

<label for="user_name">User name:</label> <%= error_message_on 'user', :name %> <%= f.text_field :name %>

generates the following error:

undefined method `errors' for :user:Symbol

I am using edge revision 5813 and the simply_helpful plugin. Is there a way to fix this?

Ingo

Hi,

The problem is in active_record_helper.rb, in the method error_message_on replace for the old code:

def error_message_on(object, method, prepend_text = "", append_text = "", css_class = "formError")         #if object = instance_variable_get("@#{object}") && errors = object.errors.on(method)         # content_tag("div", "#{prepend_text}#{errors.is_a?(Array) ? errors.first : errors}#{append_text}", :class => css_class)         #else         # ''         #end         if errors = instance_variable_get("@#{object}").errors.on(method)           content_tag("div", "#{prepend_text}#{errors.is_a?(Array) ? errors.first : errors}#{append_text}", :class => css_class)         else            ''         end       end