title: Creating Ruby ActiveRecord objects with associations
body: <p>I have Persons and Teams that have Addresses (polymorphic association)</p>
  
  <p>I need to create persons and addresses separately in code:
  <br>
  <code></p>
  
  <p>person = Person.new</p>
  
  <p>address = Address.new</p>
  
  <p></code></p>
  
  <p>and then link them together using something like:</p>
  
  <p><br>
  <code>
  person.addressable.push(address) 
  </code></p>
  
  <p>finally, do:</p>
  
  <p><code>
  person.save!
  </code></p>
  
  <p>This however gives a You have a nil object when you didn't expect it!
  The error occurred while evaluating nil.has_key?</p>
  
  <p>Could someone let me know what I need to be doing? There is little code on google that demoes any of this and all I could find was the API reference</p>