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.
backport #8176, `#pluck` can be used on a relation with `select` clause.

Conflicts:

	activerecord/CHANGELOG.md
	activerecord/lib/active_record/relation/calculations.rb
	activerecord/test/cases/calculations_test.rb
Backport #8074 to 3-2-stable. Use query cache/uncache, when using not only database.yml but also DATABASE_URL.
Merge pull request #8205 from kennyj/fix_6951-32

Backport #8074 to 3-2-stable. Use query cache/uncache, when using not only database.yml but also DATABASE_URL.
Use nil? instead of blank? to check dynamic finder result

It's safe to use `nil?` instead of `blank?` because it's impossible to get an array on finder with bang;
`all_by` finder matches against regex without bang: `when /^find_(all_|last_)?by_([_a-zA-Z]\w*)$/`.

Fixes #7238
Fix deleting from a HABTM join table upon destroying an object of a model with optimistic locking enabled. Fixes #5332.
Merge pull request #8188 from courtland/habtm-fix-stable

Fix deleting from a HABTM join table upon destroying an object of a mode...
Merge pull request #8204 from nikitug/fix_dynamic_finder_result_check

Use nil? instead of blank? to check dynamic finder result

Conflicts:
	activerecord/CHANGELOG.md
Merge pull request #8209 from senny/backport_8176

backport #8176, `#pluck` can be used on a relation with `select` clause.

Conflicts:
	activerecord/CHANGELOG.md
fix test

Conflicts:
	activerecord/test/cases/locking_test.rb
[ci skip] Correct examples for form_tag helper.
Merge pull request #8218 from DawidJanczak/form-tag-doc

[ci skip] Correct examples for form_tag helper.
Fixes issue #6251

Plugin generator crashes when using the --dummy-path option

Code was assuming the application name in `config/application.rb`
was module Dummy.
backport #8139, `plugin new` adds dummy app tasks when necessary. …
The `plugin new` generator always adds the dummy app rake tasks,
when a dummy app was created.

Closes #8224

Conflicts:

	railties/CHANGELOG.md
Merge pull request #8227 from senny/backport_8139

backport #8139, `plugin new` adds dummy app tasks when necessary
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.