Fix bug, when ':dependent => :destroy' option violates foreign key constraints, issue #12380