backport runner fixes to 3-2-stable

Add a runner hook to Rails::Application and Rails::Engine that requires
ActiveRecord::Base to avoid circular constant loading when using observers.

This commit backports cc7dd66, c0ba0f0 and 8d01c61.
test case to assert that associations do not overwrite after create, fixes #9310
adding test for the symbol refs
Fix ActiveRecord::Store not tracking changes
Merge pull request #10448 from arunagw/bug-fix-scaffold-generator-master

Fixes Scaffold generator with --assets=false
Conflicts:
	railties/CHANGELOG.md

Conflicts:
	railties/CHANGELOG.md
	railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb
Merge pull request #10466 from prathamesh-sonpatki/scaffold-assets

Fix tests related to scaffolding generator with --assets=false switch
Merging in fix from #8222
Merge pull request #10406 from greenriver/distance_of_time_rational

Correct time_ago_in_words to handle situation where Fixnum#/ returns a Rational (thanks to mathn)
Merge pull request #10478 from cainlevy/patch-1

use canonical #controller_path logic in controller test cases
Conflicts:
	actionpack/lib/action_controller/test_case.rb
Merge pull request #10489 from greenriver/ar_counter_cache_multiple_destroy

Confirm a record has not already been destroyed before decrementing counter cache

Conflicts:
	activerecord/CHANGELOG.md

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/associations/builder/belongs_to.rb
Build fix for scaffold generator 

3-2 behaves different when scaffolding.
Merge pull request #10496 from arunagw/build-fix-scaffold-generator

Build fix for scaffold generator
Revert "Remove unicode character encoding from ActiveSupport::JSON.encode"

This reverts commit 815a9431ab61376a7e8e1bdff21f87bc557992f8.

Conflicts:
	activesupport/test/json/encoding_test.rb

Reason: This was causing a regression where the resulting string is always
returning UTF-8. Also it changes the behavior of this method on a stable release.

Fixes #9498.
Revert "Merge pull request #8209 from senny/backport_8176"

This reverts commit 724020278480855bddfe749c91f1074d4f50f3c6, reversing
changes made to e4e2bcce75b85fb8c1c49509a17bd5dfe6034c32.

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/relation/calculations.rb
	activerecord/test/cases/calculations_test.rb

Reason: This caused a regression since it changed the behavior in a
stable release.

Fixes #9777
Remove useless else
Fixed pluck to be working with selects.

See #9777 for details.

Previously pluck is not returning what we wanted to
Added a test also to make sure it's working fine.
 
This will also fix the build for 1.8.7 as we 
were doing some sort on hash.

Thanks @pixeltrix for helping me out.

Thanks @linduxed for pairing with me.
Merge pull request #10552 from arunagw/pluck-fixed-3-2-stable

Pluck fixed 3 2 stable
Don't try to EXPLAIN select_db calls
Merge pull request #10555 from dasch/dasch/3-2-stable

Don't try to EXPLAIN select_db calls
Using map. No need to run query again