document `assert_not_XYZ` in place of `refute_XYZ`.
Merge pull request #11802 from ko1/fix_field_encoding_for_mysql

Set field encoding to client_encoding for mysql adapter.
Merge pull request #11910 from brendon/master

Use binary mode to write uploaded files [ci skip]
Improve the testing guide [ci skip]

Improve the "Testing Rails Applications" guide adding a section for
testing helpers and a little note about associations with ActiveRecord
and YAML fixtures.

Also add a link to Fixture Builder ; yet another replacement for
fixtures such as Machinist or FactoryGirl.
Rename @locals to @_locals in Thread to avoid conflict with Rubinius. Closes #11831
oops, I missed this in 7193f75
explain how to contribute to the documentation. [ci skip]

Follow-up to #11934

Conflicts:

	guides/source/contributing_to_ruby_on_rails.md
	guides/source/layout.html.erb
let AR::FinderMethods#exists? return singletons in all cases [closes #11592]

This fixes a regression. The documentation said in its introduction
paragraph that the method returns trythy/falsy, but then below it
was said that if there were no arguments you'd get `true` or `false`.
Also when the argument is exactly `false` a singleton is documented
to be returned.

The method was not returning the singletons so it didn't conform to
those special cases.

The best solution here seems to be to just return singletons in all
cases. This solution is backwards compatible. Also, the contract
has been revised because it has no sense that the predicate varies
that way depending on the input. I bet the previous contract was just
an accident, not something mixed on purpose.
documents 1af0c17 in the CHANGELOG
Fix the indentation on the from template of the scaffold generator
only reconnect if there was already an active connection

If you're using an in-memory database for the test database,
reconnecting will lose all information that schema:load did for us.
ensure freeze on Thread freezes locals
fix bad test by making number that fits for integer

PR https://github.com/rails/rails/pull/10566 had to be reverted
because after applying the fix test
"test_raise_record_not_found_error_when_invalid_ids_are_passed"
started failing.

In this test invalid_id is being assigned a really large number
which was causing following failure when PR #10566 was applied.

```
RangeError: bignum too big to convert into `long long'
SELECT  `interests`.* FROM `interests`
WHERE `interests`.`man_id` = ? AND `interests`.`id` = ?
LIMIT 1  [["man_id", 970345987], ["id", 2394823094892348920348523452345]]
```

This test is not failing in master because when test code
`man.interests.find(invalid_id)` is executed then interests
are fully loaded in memory and no database query is executed.

After PR #10566 was merged then test code
`man.interests.find(invalid_id)` started executing sql query
and hence the error.

In case someone is wondering why the second part of query is not
failing, then that's because the actual query does not require
any variable substituation where the number is large. In that
case the sql generate is following.

```
SELECT `interests`.* FROM `interests`
WHERE `interests`.`man_id` = ? AND `interests`.`id`
IN (8432342, 2390102913, 2453245234523452)  [["man_id", 970345987]]
```
do not load all child records for inverse case

currently `post.comments.find(Comment.first.id)` would load all
comments for the given post to set the inverse association.

This has a huge performance penalty. Because if post has 100k
records and all these 100k records would be loaded in memory
even though the comment id was supplied.

Fix is to use in-memory records only if loaded? is true. Otherwise
load the records using full sql.

Fixes #10509
Merge pull request #11948 from thedarkone/backport-11049-11051-4-0-stable

Backport #11049 and #11051 into 4-0-stable
Merge pull request #11943 from suginoy/ar-order-notation

Add examples of AR order method's hash notation to Rails Guide [ci skip]
Merge pull request #11991 from prathamesh-sonpatki/note-edge-guides

Add a note about edge guides in the feedback section [ci skip]
Merge pull request #11967 from jetthoughts/add_action_controller_bug_report_template

Added bug report template for ActionController
Merge pull request #11994 from rajcybage/fix_instance

remove not used instance variable
Merge pull request #11996 from semaperepelitsa/master

Docs: fix typo in file path, should include extension. [ci skip]