Revert fixes 

Revert data lost in https://github.com/rails/rails/commit/ec8ef1e1055c4e1598da13f49d30261f07f4a9b4

Adding more commits into this. 

I have cherry-picked most of the stuff. Remaining in docs, will be pushing in docrails may be.