Creating a module so that per thread registries can be easily created as
thread local variables.
Created a runtime registry for thread local variables in active record.
Changed the ScopeRegistry and the InstrumentationRegistry to use the
PerThreadRegistry module.
Fix inflector to respect default locale.

The inflector was made aware of locales in 7db0b073fec6bc3e6f213b58c76e7f43fcc2ab97,
but it defaulted to :en. That should actually be our default
locale instead.

Fixes #10125
Merge pull request #10156 from wangjohn/grouping_thread_locals

Grouping thread locals in ActiveRecord
Merge pull request #10158 from steveklabnik/issue_10125

Fix inflector to respect default locale.
Searching for rails executable correctly

 * Current logic of finding Rails executable in parent directory is
   not returning full path of executable if it is found in one of the
   parent directories
 * To compensate for this, we have to call exec_app_rails recursively
   until the executable is found or we cant do 'chdir' anymore
 * This solution finds the correct executable path from parent
   directory(s) recursively