Remove `default_primary_key_type`  and extract contains of `native_database_types` to a constant since they aren't conditional now in SQLite3Adapter. Makes it more like other adapters.
Merge pull request #12527 from vipulnsward/sqlite_database_types

SQLite3 Adapter datatypes cleanup
scope_chain should not be mutated for other reflections

Currently `scope_chain` uses same array for building different
`scope_chain` for different associations. During processing
these arrays are sometimes mutated and because of in-place
mutation the changed `scope_chain` impacts other reflections.

Fix is to dup the value before adding to the `scope_chain`.

Fixes #3882.
`$SAFE = 4;` has been removed with Ruby 2.1

For background -
https://bugs.ruby-lang.org/issues/8468
Changset - https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/41259/diff/test/ruby/test_thread.rb
Merge pull request #12530 from vipulnsward/remove_thread_safe

`$SAFE = 4;` has been removed with Ruby 2.1
Minor Refactoring to `NumberHelper#number_to_human`

* Use destructive `map` and `sort_by` to save extra object creation.
* Create `INVERTED_DECIMAL_UNITS.invert` constant instead of repeatedly doing `DECIMAL_UNITS.invert`
Fix `singleton_class?`

Due to changes from http://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/39628 current `singleton_class?` implementation fails.
Changed based on reference from http://bugs.ruby-lang.org/issues/7609
Remove size alias for length validation

Removed ```The `size` helper is an alias for `length`.``` line. If you use this "nonexist" helper, you will get an error message like this: 

```
ArgumentError: Unknown validator: 'SizeValidator'
...
```

Maybe wanted to mean ```validates_size_of``` helper as an alias for ```validates_length_of``` helper.
Merge pull request #12532 from vipulnsward/singleton_class

Fix `singleton_class?`
Merge pull request #10538 from neerajdotname/3882

scope_chain should not be mutated for other reflections
only calculate offset index once. #12537
the preloader for the RHS has all the preloaded records, so ask it
simplify populating the ordering hash
Merge pull request #12536 from sbagdat/patch-1

Remove size alias for length validation
Add 2 tests, 1 of which fails, to isolate the digest_caching behaviour causing #12521

If config.action_view.cache_template_loading = false, most likely in a development
configuration if config.cache_classes = false &
config.action_controller.perform_caching = true.

config.action_view.cache_template_loading defaults to the value of config.cache_classes
Ensure ActionView::Digest.cache is correctly cleaned up when
ActionView::Resolver.caching = false.
update changelog
we should have unique sponsorable ids in the fixtures at least
read the association instead of sending
rm JoinHelper from JoinAssociation