Making test accurately reflect what is going on in the schema migrations test
use bind values for join columns

This is a backport of 4bc2ae0da1dd812aee759f6d13ad428354cd0e13.
It fixes bug #7950.

Conflicts:

	activerecord/lib/active_record/relation/calculations.rb
	activerecord/lib/active_record/relation/finder_methods.rb
Test/changelog for has_many bug on unsaved records

See issue #7950.

The previous commit fixes this bug, and is a backport of
4bc2ae0da1dd812aee759f6d13ad428354cd0e13.
Merge pull request #8235 from tilsammans/dont_escape_actionmailer_when_plaintext

Introduce `ActionView::Template::Handlers::ERB.escape_whitelist`

Conflicts:
	actionpack/CHANGELOG.md
	actionpack/test/template/template_test.rb
Merge pull request #7983 from georgebrock/bug7950-squashed

Backport 4bc2ae0 to fix #7950

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/relation/calculations.rb
Fix bug when url_for changes controller.
Refactor Generator class to not rely on in-place editing the controller
Add changelog entry for #6003 backport
Remove the git option from ruby-prof gem pointing to wycats repo.

According to him, at one point his fork was the one that had the call
stack printer, and it's in the main repo now.

[ci skip]
Upgrade mail dependency to 2.5.0
Upgrade mail dependency to 2.5.2
backport #8262, require bundler groups to include rake-tasks in engines

If you generate a full engine, this will include rake tasks from
your gem under the `app` namespace. For example if you have a dependency
on `rspec-rails` in your engine's `gemspec`. You will get the task `app:spec`

Closes #8229

Conflicts:

	railties/CHANGELOG.md
Merge pull request #8271 from senny/backport_8262

backport #8262, require bundler groups to include rake-tasks in engines
Merge pull request #8258 from kommen/eager_loading_with_select_test2

Add test to ensure preloading works as expected with "group", "select" and "includes".
Conflicts:
	activerecord/test/cases/relations_test.rb

Chery-pick a739340d3c9e66814429af6f3f410c01ff86810a:
Ensure ordering to make the test pass with postgresql

Conflicts:
	activerecord/test/cases/relations_test.rb
Be a bit less conservative with mysql in adapter

This will allow the new mysql 2.9.0 to be used, fixing our test issues.
Merge pull request #8276 from pwnall/pgsql_text_limits

Postgresql doesn't accepts limits on text columns
Conflicts:
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
Merge pull request #8280 from asanghi/fix_guide_field_with_error_proc

fix guide with field_with_error proc example

[ci skip]
backport #8291, prevent mass assignment of polymorphic type with `build`

Closes #8265

Conflicts:

	activerecord/CHANGELOG.md
	activerecord/lib/active_record/associations/association.rb
Merge pull request #8295 from senny/8265_backport

backport #8291, prevent mass assignment of polymorphic type with `build`
Merge pull request #8311 from alisdair/dirty-nullable-datetime

Don't call will_change! for datetime nil->"".

Setting a nil datetime attribute to a blank string should not cause the
attribute to be dirty.

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