Fix regression introduced in pull request 8812

See https://github.com/rails/rails/pull/8812#commitcomment-2416514
Merge pull request #8907 from rubys/master

Fix regression introduced in pull 8812