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
rake railties:install:migrations respects the order of railties
ActiveRecord <-> Active Record [ci skip]
Merge pull request #8949 from joneslee85/patch-2

ActiveRecord <-> Active Record [ci skip]
Revert "Merge pull request #8942 from yahonda/tested_only_with_mysql"

This reverts commit 1fc294f988e93ac59057a16b0e44b9cf93af9720, reversing
changes made to fb9ac47c286fbdfe05263d4d0346e50892090603.

Reason: these tests should run fine independent of database, since they
should only take into account the configuration options. The problem was
related to a change in the way "nil" is handled by the rescue clause, in
Ruby 2.0 it raises an exception asking for class or module, in 1.9 it
passes.
Improve mysql database tasks handling to ensure we always rescue from an exception

We were previously rescuing "nil" when no exception class was found.
This does work in 1.9.3, but does not in 2.0, raising an exception
asking for a class or module to be given to the rescue clause.

Thanks @yahonda for catching this.
Revert "log at debug level what line caused the redirect_to"

This reverts commit 3fa00070047b5d019d39e691598ee2890283d052.

Reason: This message is usually not accurate and annoying:

    Redirected by ~/.rbenv/versions/1.9.3-p327-perf/lib/ruby/1.9.1/logger.rb:371:in `add'`
Merge pull request #8930 from cordawyn/ordered_railties

rake railties:install:migrations respects the order of railties
Cleaning up ActiveModel::Dirty tests

* Clarifying what the #changed method returns
* Adding tests to describe what the #changed_attributes returns
* Updating test name based on pull request comment
* Moving the test lower in the file per pull request comment
Revert "Merge pull request #8930 from cordawyn/ordered_railties"

This reverts commit 8348f9ea72c9b50fc4d4462fd9ebe3bba932c783, reversing
changes made to 9dfe2d6f9fabddf9a451a995678a9648c8aaf401.

Reason: this broke railties tests as explained in the issue, and the
author is going to review and report back.

https://github.com/rails/rails/pull/8930#issuecomment-12272671
Update guides/source/active_record_validations.md

Duplicated `update`
Raise correct exception now Journey is integrated.

Now that Journey has been integrated into ActionDispatch we can raise
the exception ActionController::UrlGenerationError directly rather than
raising the internal Journey::Router::RoutingError and then have
ActionDispatch::Routing::RouteSet#generate re-raise the exception.
Ensure port is set when passed via the process method
Add support for other types of routing constraints

This now allows the use of arrays like this:

  get '/foo/:action', to: 'foo', constraints: { subdomain: %w[www admin] }

or constraints where the request method returns an Fixnum like this:

  get '/foo', to: 'foo#index', constraints: { port: 8080 }

Note that this only applies to constraints on the request - path
constraints still need to be specified as Regexps as the various
constraints are compiled into a single Regexp.
Change the behavior of route defaults

This commit changes route defaults so that explicit defaults are no
longer required where the key is not part of the path. For example:

  resources :posts, bucket_type: 'posts'

will be required whenever constructing the url from a hash such as a
functional test or using url_for directly. However using the explicit
form alters the behavior so it's not required:

  resources :projects, defaults: { bucket_type: 'projects' }

This changes existing behavior slightly in that any routes which
only differ in their defaults will match the first route rather
than the closest match.

Closes #8814
use case statement
allow :dirs option for .enumerate

Allows custom rake tasks to be defined using:

  SourceAnnotationExtractor.enumerate 'TODO|FIXME', dirs: %w(app lib), tag: true
Merge pull request #8940 from adomokos/adding_tests_for_changed_attributes

Cleaning up ActiveModel::Dirty tests
Merge pull request #8954 from davetoxa/patch-1

Update guides/source/active_record_validations.md