patch for breach; adapted from https://github.com/rails/rails/pull/11729/