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.
adding test for CVE
backport of fix for issue #7630
Merge pull request #9278 from matthewrobertson/backport-hmt-counter-cache-bug

Backport of #8400 to fix for issue #7630, a bug in has_many :through counter caches.
Fixed changelog typos [ci skip]
Merge pull request #9288 from jmccartie/jm/typos

Fixed changelog typos [ci skip]
Fix typo in railties changelog [ci skip]

Other changelogs were fixed in f15581b1bab8fa042f4614f9b2709c3c580ad9d1.
Add Ruby 2.0 RC to Travis CI build matrix
Merge pull request #9289 from rails/3-2-stable-test-with-ruby-2

Add Ruby 2.0 RC to Travis CI build matrix
Merge pull request #9252 from senny/8423_hmt_preloading_bug

don't cache invalid subsets when preloading hmt associations
Conflicts:
	activerecord/CHANGELOG.md
	activerecord/test/cases/associations/eager_test.rb
Fix the CHANGELOG headers [ci skip]
Do not put the version in unreleased changes [ci skip]
Revert "Merge pull request #9252 from senny/8423_hmt_preloading_bug"

This reverts commit c5451777b038c5e48567f69256986ae42a2cde48.

Conflicts:
	activerecord/CHANGELOG.md
Update activemodel/CHANGELOG.md

Fixed a typo
Merge pull request #9308 from joernchen/patch-1

Update activemodel/CHANGELOG.md
Fix handling of dirty time zone aware attributes

Previously, when `time_zone_aware_attributes` were enabled, after
changing a datetime or timestamp attribute and then changing it back
to the original value, `changed_attributes` still tracked the
attribute as changed. This caused `[attribute]_changed?` and
`changed?` methods to return true incorrectly.

Example:

    in_time_zone 'Paris' do
      order = Order.new
      original_time = Time.local(2012, 10, 10)
      order.shipped_at = original_time
      order.save
      order.changed? # => false

      # changing value
      order.shipped_at = Time.local(2013, 1, 1)
      order.changed? # => true

      # reverting to original value
      order.shipped_at = original_time
      order.changed? # => false, used to return true
    end

(cherry picked from commit bc982cbcb34129ea2cfe8aa1f8e0b40e444e68db)

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb

Backport of #9073
Fixes #8898
Allow failures to 2.0.0
don't cache invalid subsets when preloading hmt associations.

Backport #9252.

Conflicts:

	activerecord/CHANGELOG.md
	activerecord/test/cases/associations/eager_test.rb

The preloader code on 3-2-stable is not based on relations but on option hashes.
I had to modify the original patch and comparing the option hashes could be more
fuzzy than comparing the relations. All the tests passed though.
Merge pull request #9322 from senny/backport_9252

don't cache invalid subsets when preloading hmt associations.
keep the build :green_heart:, #first on 1.8.7 and pg is different

The build only failed for ruby-1.8.7 and pg. The problem was that the statement:

```ruby
author = Author.includes(:comments_with_order_and_conditions, :posts).first
```

resulted in Author with ID 2 where on all other rubies / db-engines Author with ID 1
was retunred. Of course this breaks the assertions.