Save has_one associations only if record has changes

Prevents save related callbacks such as `after_commit` being
triggered when `has_one` objects are already persisted and have no
changes.
Only use BINARY for mysql case sensitive uniqueness check when column has a case insensitive collation.
Handle missing environment from non empty config

If using a `DATABASE_URL` and a `database.yml`. The connection information in `DATABASE_URL` should be merged into whatever environment we are in. As released in 4.1.0rc1 if someone has a database.yml but is missing a key like production:

```yml
development:
  host: localhost

```

Then the check for blank config will return false so the information from the `DATABASE_URL` will not be used when attempting to connect to the `production` database and the connection will incorrectly fail.

This commit fixes this problem and adds a test for the behavior.

In addition the ability to specify a connection url in a `database.yml` like this:

```
production: postgres://localhost/foo
```

Was introduced in 4.1.0rc1 though should not be used, instead using a url sub key

```
production:
  url: postgres://localhost/foo
```

This url sub key was also introduced in 4.1.0rc1 though the `production: postgres://localhost/foo` was not removed. As a result we should not test this behavior.
typos fixes
Tweak Configuring Guide language

the fact that Rails is multi-thread by default is not very relevant. see https://github.com/rails/rails/pull/13998 [ci skip]
:scissors:

This commit also addresses rails/docrails#169 and rails/rails#14159
Fixed STI classes not defining an attribute method if there is a
conflicting private method defined on its ancestors.

The problem is that `method_defined_within?(name, klass, superklass)`
only works correclty when `klass` and `superklass` are both `Class`es.

If both `klass` and `superklass` are both `Class`es, they share the
same inheritance chain, so if a method is defined on `klass` but not
`superklass`, this method must be introduced at some point between
`klass` and `superklass`.

This does not work when `superklass` is a `Module`. A `Module`'s
inheritance chain contains just itself. So if a method is defined on
`klass` but not on `superklass`, the method could still be defined
somewhere upstream, e.g. in `Object`.

This fix works by avoiding calling `method_defined_within?` with a
module while still fufilling the requirement (checking that the
method is defined withing `superclass` but not is not a generated
attribute method).

4d8ee288 is likely an attempted partial fix for this problem. This
unrolls that fix and properly check the `superclass` as intended.

Fixes #11569.
Simple Sungularize ActionController::UnpermittedParameters error in case when only 1 parameter is unpermitted.
refactor, extract `with_locale` helper.
Go with #presence_in instead of #present_in -- it doesnt sound quite as good, but the closer relationship to #presence over #present is ultimately worth it
Fix ActionView label translation for more than 10 nested elements
Merge pull request #14170 from kritik/master

there could be more than 10 nested records
refactor, with_locale is not needed because I18n is mocked.

This is a follow up to #14170. While backporting I recognized
that this call is not needed at all.
[skip ci] Fix typo in link_to :method option description
Merge pull request #14182 from mecampbellsoup/fix_typo_in_url_helper_docs

[skip ci] Fixing typo in documentation: actionview/lib/action_view/helpers/url_helper.rb
[skip ci] Standardized punctuation.
Merge pull request #14186 from ch33hau/standardized-punctuation

Standardized punctuation.
Merge pull request #14006 from Loremaster/strong_params_improvement

Sungularize ActionController::UnpermittedParameters error in case when only 1 parameter is unpermitted.
`ActionDispatch::Head` was replaced by `Rack::Head`. Closes #14191.

See 449039a86d802871b707dfb51ac1ed96d53526f9 for the original commit.
Add missing parantheses in index_exists?