Rails Nested Object Form *_attributes problem

My model code is:

class Person < Party
  has_one :name, :class_name => "PersonName"
  accepts_nested_attributes_for :name, :allow_destroy => true

class PersonName < ActiveRecord::Base
  belongs_to :person

My view code looks like this (I'm using HAML):

%h3 New customer
= error_messages_for :person, :person_name, :name, :country

- form_for :person, :url => collection_url, :html => {:class =>
'MainForm'} do |person_form|

  - @person.build_name unless @person.name
  - person_form.fields_for :name do |name_form|
    = name_form.label :given_name, "First Name:"
    = name_form.text_field :given_name

    = name_form.label :family_name, "Last Name:"
    = name_form.text_field :family_name

  = hidden_field_tag :inviter_id, params[:inviter_id]
  = hidden_field_tag :inviter_code, params[:inviter_code]
  %p= submit_tag "Create"

= link_to 'Back', collection_url

Hi Damon, this is quite an unusual error as the '_attributes' suffix
is hard coded to be appended when the record object responds to symbol
+ '_attributes=' (where symbol in this case is 'name'). I would check
to make sure that person_form.object is definitely the @person object.
Especially as it looks like you are setting @name in the controller
for the error_messages_for. In fact I think posting the controller
code would be quite useful if you're still stuck.

Best regards,