Forum: Ruby on Rails Problem w/ error_messages_for: wrong number of arguments?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Graham G. (Guest)
on 2006-04-11 09:34
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:in
`error_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
This topic is locked and can not be replied to.