Fix regression introduced in pull 8812

See https://github.com/rails/rails/pull/8812#commitcomment-2416514