title: How to remove the association after deleting a model object
body: <p>I have a simple has_many/belongs_to association between 2 of my models.
  My problem is that when I delete an object that I no longer want (from the parent model), the foreign key within the child model's object remains. For example:</p>
  
  <p><strong>Forest</strong></p>
  
  <p><code>has_many :trees, :inverse_of =&gt; :forest</code></p>
  
  <p><strong>Tree</strong></p>
  
  <p><code>belongs_to :forest</code></p>
  
  <p>When I delete a <code>Forest</code> object, all the associated <code>Tree</code> objects still contain a value for <code>forest_id</code>, which results in errors on the frontend. Is there some sort of hook like <code>before_destroy</code> that I can use? Though I'm thinking there's probably a very simple solution to this.</p>
  
  <p>Thanks</p>