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
Fix "Scaling Rails Screencasts" link in caching guide

Closes #10241 [ci skip]
Use secure source in generated Gemfile for creating new plugin. Closes #10245
Merge pull request #10246 from prathamesh-sonpatki/3.2.13-https-rubygems

Using secure source https://rubygems.org when generating new plugin with Rails 3.2
adding a test for root path in the app
just clear the caches on clear! rather than replacing. fixes #10251
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