Fix .update_all and .delete_all when using a condition on a joined table
in a default_scope.

`Model.joins(...).where(condition_on_joined_table).update_all` /
`delete_all` worked, but the same operation implemented with a
default_scope generated a SQL error because ActiveRecord ignored the
join but implemented the where condition anyways.
`CollectionAssociation#empty?` respects newly builded records
adding regression test in master for #8631
Merge pull request #8963 from asanghi/regress_8631

adding regression test in master for #8631
Remove warnings: "(...) interpreted as grouped expression"
Don't rely on Hash key's ordering

If we set encoding latin1 for a PostgreSQL database, it calls
PostgreSQLAdapter::create_database with options that have,
among other things:

  { 'encoding' => 'latin1' }

Then, we use reverse_merge(:encoding => "utf8") to setup the default
encoding. In the end, the hash looks like:

  { :encoding => 'utf8', 'encoding' => 'latin1' }

The call to options.symbolize_keys calls to_sym on each_key of this
Hash. It usually means that the encoding passed overwrites the default
utf8, but it's not guaranteed. So, we shouldn't rely on it.

The same was happening in ActiveRecord::ConnectionHandling.
Merge pull request #8959 from vitorbaptista/master

Don't rely on Hash key's ordering to configure default options
document Intercepters in ActionMailer guide
Fix date_select :selected option so you can pass it nil
Merge pull request #8965 from colinbm/date_select_value

Fix date_select :selected option so you can pass it nil
Merge pull request #8967 from senny/add_interceptor_to_am_doc

document Intercepters in ActionMailer guide
clear specific logs when using rake log:clear
Merge pull request #8964 from mattdbridges/specify-log-to-clear

Clear specific logs when using `rake log:clear`
Deprecate direct calls to AC::RecordIdentifier.dom_id and dom_class

Also add some generic tests to ensure they're properly deprecated.
Removing : warning: ambiguous first argument;
Merge pull request #8975 from arunagw/warning_removed_ambiguous_first_argument

Removing : warning: ambiguous first argument;
Remove useless || operation
spelling correction for AM interceptors
Merge pull request #8976 from senny/spelling_correction

spelling correction for Action Mailer interceptors
Fix ActionDispatch::Request#formats when HTTP_ACCEPT header is empty string