Adding documentation to the Rails initialization guide. [ci skip]
Merge pull request #11160 from wangjohn/documentation_for_railties_initialization_guide

Adding documentation to the Rails initialization guide.
writing the new body can cause the response to be committed and the
request thread to return up the stack before the instance variable is
assigned.  Synchronize so that the ivar is assigned before the other
thread can activate.

fixes #10984
use bytesize rather than force encoding