Merge pull request #16044 from jjb/patch-1

[ci skip] link directly to ActionMailer Previews documentation
active_record: Type cast booleans and durations for string columns.
Merge pull request #16069 from dylanahsmith/mysql-quote-bool

active_record: Type cast booleans and durations for string columns.
Generate shallow paths for all children of shallow resources.

Prior to this commit shallow resources would only generate paths for
non-direct children (with a nested depth greater than 1).

Take the following routes file.

    resources :blogs do
      resources :posts, shallow: true do
        resources :comments do
          resources :tags
        end
      end
    end

This would generate shallow paths for `tags` nested under `posts`,
e.g `/posts/:id/tags/`, however it would not generate shallow paths
for `comments` nested under `posts`, e.g `/posts/:id/comments/new`.

This commit changes the behaviour of the route mapper so that it
generate paths for direct children of shallow resources, for example
if you take the previous routes file, this will now generate
shallow paths for `comments` nested under `posts`, .e.g
`posts/:id/comments/new`.

This was the behaviour in Rails `4.0.4` however this was broken in
@jcoglan's fix for another routes related issue[1].

This also fixes an issue[2] reported by @smdern.

[1] https://github.com/rails/rails/commit/d0e5963
[2] https://github.com/rails/rails/issues/15783
[ci skip] /sqlite/i --> SQLite
Merge pull request #15958 from aditya-kapoor/active-model-naming-guide

[ci skip] add guide for ActiveModel::Naming
Merge pull request #16057 from akshay-vishnoi/doc_change

[ci skip] /sqlite/i --> SQLite
Change back occurrences of SQLite(3) to sqlite3 when referring to the
adapter, fixed from #16057 [ci skip]
Remove PG's definition of `type_cast`

All cases except for `nil` in an array have been removed. `nil` in an
array is handled by the Array type object.
Don't rely on the sql type to quote XML columns in PG
Remove the `text?` predicate from the type objects

This was only used for uniqueness validations. The first usage was in
conjunction with `limit`. Types which cast to string, but are not
considered text cannot have a limit. The second case was only with an
explicit `:case_sensitive => true` option given by the user.
Fix ActiveSupport::Callbacks #set_callback docs.

A minor version breakage due to a rewrite of the callbacks code now
requires an explicit block to be passed to #set_callback. This amends
the documentation.
Merge pull request #16075 from nickpellant/master

Fix ActiveSupport::Callbacks #set_callback docs.
Avoid retrieving connection in ActiveRecord::QueryCache multiple times.
Prefer find_by over where.first for record
Add callbacks documentation for upgrading to 4.1.

It is now expected in 4.1 to use an explicit block rather than implicit
when setting callbacks through ActiveSupport::Callbacks. This commit
highlights this new expectation as part of the upgrading documentation.
Update Rails versions [ci skip]

As discussed in #15304, we need to automate this process but for now,
having out-of-date versions is not ideal.

Since master targets 4.2.0, let's also update references to the last 4.1
version to 4.2.0.

Finally, let's remove mentions to versions when this is not needed. The
guides cover the features of the current version anyway.

[Juanito Fatas + Robin Dupret]
[ci skip] Improve callback code example for 4.1 upgrade docs.

The previous code example for the new explicit block requirement when
setting callbacks was a little confusing. This commit makes the example
more obvious.
Merge pull request #16086 from nickpellant/master

Add callbacks documentation for upgrading to 4.1.
Merge pull request #16074 from sgrif/sg-remove-text-predicate

Remove the `text?` predicate from the type objects