title: Incorrect plural error messages with nested attributes
body: <p>Using Rails 3.1.3. I have Accounts and Users. One Account can have many Users. I set this up using <code>accepts_nested_attributes_for</code> as described in <a href="https://stackoverflow.com/questions/8305120/use-both-account-and-user-tables-with-devise/8529340#8529340">this answer</a>.</p>
  
  <p>I have a new.html.erb view that accepts data for one account and one user at the same time.  (The user's data goes into a "subform.")  The form works fine. However if there is an error, the messages for the subform's fields are pluralized, even though they should be singular. For example, I get</p>
  
  <pre><code>Users password doesn't match confirmation
  Users password is too short (minimum is 8 characters)
  </code></pre>
  
  <p>instead of </p>
  
  <pre><code>User password doesn't match confirmation
  User password is too short (minimum is 8 characters)
  </code></pre>
  
  <p>I don't think this is an inflection issue, since "User" follows standard pluralization rules. Rather it must have to do with the use of nested attributes in a subform.  In my case, the subform returns an array containing one user, but theoretically it could return data for multiple users.</p>
  
  <p>How/where can I tell Rails not to pluralize when referring to only one element of an array?</p>
  
  <p><hr/>
  <strong>Edit 3/14/2012 to show controller and view:</strong></p>
  
  <p><strong>app/controllers/accounts_controller.rb</strong> ("New" action only):</p>
  
  <pre><code>class AccountsController &lt; ApplicationController
    before_filter :authenticate_user!, :except =&gt; [:new, :create]
    before_filter :user_signed_out,    :only   =&gt; [:new, :create]
    load_and_authorize_resource # CanCan - does a standard load for each action, and authorizes user
  
    def new
      # CanCan:  @account = Account.new (and tests each attribute for ability)
      @account.users.build
      @title = "Sign Up for a New Account"
      @header = "Sign up for a new account"
    end
  end
  </code></pre>
  
  <p><strong>app/views/accounts/new.html.erb</strong>:</p>
  
  <pre><code>&lt;h2&gt;&lt;%= @header %&gt;&lt;/h2&gt;
  
  &lt;%= form_for(@account) do |f| %&gt;
    &lt;%= render 'account_fields', :f =&gt; f %&gt;
  
    &lt;%= f.fields_for :users do |user_form| %&gt;
      &lt;div class="field"&gt;&lt;%= user_form.label :email %&gt;&lt;br /&gt;
      &lt;%= user_form.email_field :email %&gt;&lt;/div&gt;
      &lt;div class="field"&gt;&lt;%= user_form.label :password %&gt;&lt;br /&gt;
      &lt;%= user_form.password_field :password %&gt;&lt;/div&gt;
      &lt;div class="field"&gt;&lt;%= user_form.label :password_confirmation %&gt;&lt;br /&gt;
      &lt;%= user_form.password_field :password_confirmation %&gt;&lt;/div&gt;
    &lt;% end %&gt;
  
    &lt;div class="actions"&gt;
      &lt;%= f.submit "Create Account" %&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>I was trying <code>error_messages_for</code> inside the <code>f.fields_for</code> block above.</p>
  
  <p><strong>app/views/shared/_error_messages.html.erb</strong> rendered by layout before all views:</p>
  
  <pre><code>&lt;% if object.errors.any? %&gt;
    &lt;div id="error_explanation"&gt;
      &lt;h2&gt;&lt;%= pluralize(object.errors.count, "error") %&gt; 
        prohibited this &lt;%= object.class.to_s.underscore.humanize.downcase %&gt;
        from being saved:&lt;/h2&gt;
      &lt;p&gt;There were problems with the following fields:&lt;/p&gt;
      &lt;ul&gt;
      &lt;% object.errors.full_messages.each do |msg| %&gt;
        &lt;li&gt;&lt;%= msg %&gt;&lt;/li&gt;
      &lt;% end %&gt;
      &lt;/ul&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>