title: How access ActiveRecord::AutosaveAssociation.marked_for_destruction? from within parent model
body: <p>I have a model, Person, with the following association:</p>
  
  <pre><code>has_many :distributions
  
  accepts_nested_attributes_for :distributions, :allow_destroy =&gt; true
  
  validate :distributions_must_total_100
  </code></pre>
  
  <p>The custom validation currently fails when it shouldn't -- when some of the validations have been marked for destruction -- because they still show up in the attribute "distributions" (in memory, never mind what's in the DB) before the Person and its Distributions are saved.</p>
  
  <p>I would like to use <code>ActiveRecord::AutosaveAssociation.marked_for_destruction?</code> within my validator, to ignore the distributions that are about to be destroyed. </p>
  
  <ol>
  <li><p>How do I reach that method? Not quite sure what the relationship of Distribution (your normal Rails model) is to that class.</p></li>
  <li><p>Is this a horrible unclean hack? It only feels a little dirty, and it's the most precise fix for the problem.</p></li>
  </ol>
  
  <p>I did step through the ActiveRecord source code in the debugger to confirm that the records actually are marked for destruction (i.e. not a Javascript or form builder bug).</p>