Problem w/ error_messages_for: wrong number of arguments?


#1

Hi guys,

I just upgraded to the latest version of Rails 1.1 and am getting some
odd error messages. Specifically, I have the line:

<%= error_messages_for ‘user’ %>

at the top of one of my .rhtml files and of course a variable @user.
When an error occurs when saving ‘user’, instead of getting the error
message (which happened fine in Rails 1.0), I now get the message:

wrong number of arguments (2 for 1)

with the traceback:

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/helpers/active_record_helper.rb:110:in
pluralize' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_view/helpers/active_record_helper.rb:110:inerror_messages_for’

If I look at the line in active_record_helper that calls pluralize, it
says:

“#{pluralize(object.errors.count, “error”)} prohibited this
#{object_name.to_s.gsub(”_", " “)} from being saved”

This makes me think that the runtime system is calling the wrong version
of pluralize (the Inflector version which doesn’t take 2 arguments.

Has anyone else encountered the same problem or have an ideas how to fix
it?

Cheers,
Graham