Merge pull request #8313 from alan/only_save_changed_has_one_objects

Save has_one associations only if record has changes

Conflicts:
	activerecord/CHANGELOG.md

Conflicts:
	activerecord/CHANGELOG.md
Fixes STI when 2+ levels deep.

PR #14052 Added a regression where it was only looking for methods in one
level up, So when the method was defined in a 2+ levels up the
inheritance chain, the method was not found as defined.
only write the jar if the response isn't committed

when streaming responses, we need to make sure the cookie jar is written
to the headers before returning up the stack. This commit introduces a
new method on the response object that writes the cookie jar to the
headers as the response is committed.  The middleware and test framework
will not write the cookie headers if the response has already been
committed.

fixes #14352
use the body proxy to freeze headers

avoid freezing the headers until the web server has actually read data
from the body proxy.  Once the webserver has read data, then we should
throw an error if someone tries to set a header

Conflicts:
	actionpack/lib/action_controller/metal/live.rb
Use Sqlite3 adapter in examples

Two bits of example code use sqlite as an adapter, which doesn't exist.
Using the code verbatim will raise a LoadError exception:

    ActiveRecord::Base.establish_connection(
      "adapter"  => "sqlite",
      "database" => "db.sqlite"
    )
    # => LoadError: Could not load 'active_record/connection_adapters/sqlite_adapter'...

Considering this is code a lot of people new to Rails might be running,
it's especially confusing.

Closes #14367 [ci skip]
make tests pass on Ruby 2.2

Apparently we've been using a buggy feature for the past 6 years:

  https://bugs.ruby-lang.org/issues/9593
require actions rather than create_file

thor's create_file seems to have a circular dependency on itself when
used with our constant loading stuff.

fixes #14319
Merge pull request #14372 from arthurnn/fix_query_cache_binds

Make select_all on query cache accept a Relation without binds.
Conflicts:
	activerecord/CHANGELOG.md
No need to binds be optional
Fix probs in sections 5.6 and 5.9; [ci skip]
Force sass-rails ~> 4.0.2 to avoid sprockets compatibility error

See https://github.com/rails/sass-rails/issues/191 for more information
Match the whole string
Take in consideration guides CHANGELOG
Merge pull request #14329 from pch/digestor-lookup-fix

Ensure LookupContext in Digestor selects correct variant
Fix the resolver cache and stop mutating the lookup_context

Before we had a bug in the resolver cache so the disable_cache were not
working when passing options to find
Merge pull request #14373 from schneems/schneems/jdbc-ar-2

Allow custom JDBC urls
Obey `validate: false` option for habtm

Fixes #14383.
Remove deprecation on active_support/core_ext/class/attribute_accessors requires. Appropriate to keep this, users don't care that the implementation got unified.
Clarify AV::Digestor.digest method signature docs and deprecation warning
Fix MailerPreview broken tests

`BaseMailerPreview.welcome` is an instance method, so we need to stub the
method on a instance level and not on Class. The stub is important to make
sure the Message object is the same in the other expectations.
This was working randomly because Mocha uses == to compare two objects
on the `with()` expectation and even if the Mail::Message objects were
not the same object they are equal, but thats not the case in 100% of
the runs. So we need to make sure we use `.any_instance` method and have
the right message object.