title: How to build ActiveRecord associations with STI
body: <p>I'm having problems with AR trying to build associations of models that inherit from others. The problem is the associated models are being saved to the database before the call do the save method.</p>
  
  <p>I found more information in this page <a href="http://techspry.com/ruby_and_rails/active-records-or-push-or-concat-method/" rel="nofollow">http://techspry.com/ruby_and_rails/active-records-or-push-or-concat-method/</a></p>
  
  <p>That's really weird, why would AR automatically save models appended to the association (with &lt;&lt; method) ? One would obviously expect that the save method must called, even if the parent already exists. We can prevent this calling </p>
  
  <pre><code>@user.reviews.build(good_params)
  </code></pre>
  
  <p>but this would be a problem in a context where the association have an hierarchy, for example: if a Hunter has_many :animals, and Dog and Cat inherit from Animal, we can't do </p>
  
  <pre><code>@hunter.dogs.build
  @hunter.cats.build 
  </code></pre>
  
  <p>instead we are stuck with </p>
  
  <pre><code>@hunter.animals &lt;&lt; Cat.new
  @hunter.animals &lt;&lt; Dog.new 
  </code></pre>
  
  <p>and if the Cat/Dog class has no validations, the object will be saved automatically to the database. How can I prevent this behaviour ?  </p>