title: Ruby on Rails - Association gets deleted before "before_destroy"
body: <p>I have an object <code>A</code> that has_many <code>B</code>'s (simple association):</p>
  
  <pre><code>has_many :book_accounts, {
      dependent: :destroy
  }
  </code></pre>
  
  <p>I was working on a <code>before_destroy</code> callback. I want to check and make sure that there are no <code>C</code>'s (which belongs_to <code>B</code>) and <code>D</code>'s (which belongs_to <code>C</code>) before destroying the <code>A</code>. I checked the log and all of the <code>B</code>'s are getting deleted before the callback causing the callback to crash.</p>
  
  <p>Is this how Rails is supposed to work? Is there something I can do other than removing the <code>dependent: destroy</code> and manually destroying the <code>B</code>'s in an <code>after_destroy</code> callback? Or is that the go-to solution?</p>