Bring in rails/rails#9857