title: Rails 3 Nested Resources Edit/Update Controller
body: <p>I'm wrapping my head around Nested Resources (awesome btw) and I have a question in regards to the Edit and Update actions in my controller.</p>
  
  <p>My route is set up with the following:</p>
  
  <pre><code>resources :events do
   resources :people
  end
  </code></pre>
  
  <p>In my People controller, I have the following for the New action:</p>
  
  <pre><code> @event = current_user.events.find(params[:event_id])
   @person = @event.people.build
   @person.build_address
  </code></pre>
  
  <p>and for the Create action I have:</p>
  
  <pre><code>@event = current_user.events.find(params[:event_id])
  @person = @event.people.build(params[:person]) 
  </code></pre>
  
  <p>This all works great.</p>
  
  <p>I'm unsure of what I need to do for the Edit and Update actions though. Googling hasn't yielded any good links.</p>
  
  <p>Here are my models:</p>
  
  <pre><code>class Event &lt; ActiveRecord::Base
     belongs_to :user
     belongs_to :address
     has_many :people
     accepts_nested_attributes_for :address, :allow_destroy =&gt; true
  end
  
  class Person &lt; ActiveRecord::Base
    belongs_to :event
    belongs_to :address
    accepts_nested_attributes_for :address, :allow_destroy =&gt; true
  end
  
  class Address &lt; ActiveRecord::Base
    has_many :people
    has_many :events
  end
  </code></pre>
  
  <p>I basically want to make sure that when I edit a person, AR will update the correct event id and address id along with the person's details.</p>
  
  <p>Thanks!</p>