title: ERROR: delete on table violates foreign key constraint. Key id is still referenced from table (many)
body: <p>I'm working with Rails and PostgreSQL and have a basic one-to-many relationship going on, one <code>Auction</code> has many <code>Bid</code>s. However when I try and delete an auction (that has bids present) I get the following error: </p>
  
  <blockquote>
    <p>ERROR: update or delete on table "auctions" violates foreign key
    constraint "fk_rails_43e9021cbf" on table "bids". DETAIL: Key(id)=(1)
    is still referenced from table "bids".</p>
  </blockquote>
  
  <p>Deleting auctions with no bids gives no error.</p>
  
  <p>The part that confuses me is that inside my <code>Auction</code> model, I have:</p>
  
  <pre><code>has_many :bids, dependent: :destroy
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/yFFAU.jpg" alt="Error Screen Shot (better_error gem)"></p>
  
  <p>Since I have a dependent destroy clause, why am I still getting this error?</p>
  
  <p><strong>EDIT:</strong> I've tried dropping the whole DB, then recreating/re-migrating everything - still get the same error.</p>