Backport relation merger updates from 9675c7d to 4-0-stable

Fixes #10995.
doc fix. Use `sess.path` within `open_session`. Closes #13490. [ci skip]

Conflicts:
	guides/source/testing.md
Fix Encoding::CompatibilityError when public path is UTF-8

In #5337 we forced the path encoding to ASCII-8BIT to prevent static
file handling from blowing up before an application has had chance to
deal with possibly invalid urls. However this has a negative side
effect of making it an incompatible encoding if the application's
public path has UTF-8 characters in it.

To work around the problem we check to see if the path has a valid
encoding once it has been unescaped. If it is not valid then we can
return early since it will not match any file anyway.

Fixes #13518

(cherry picked from commit 436ed5171199ae1764ce413044dad8d1556b7791)
Test with 2.1.0
Allow engine root relative redirects using an empty string.

Example:

    # application routes.rb
    mount BlogEngine => '/blog'

    # engine routes.rb
    get '/welcome' => redirect('')

This now redirects to the path `/blog`, whereas before it would redirect
to the application root path. In the case of a path redirect or a custom
redirect if the path returned contains a host then the path is treated as
absolute. Similarly for option redirects, if the options hash returned
contains a `:host` or `:domain` key then the path is treated as absolute.

Fixes #7977

(cherry picked from commit b64bac489c58ce1169941f77f4d633cb4eb87cd8)
Merge pull request #13561 from robin850/issue-11723

Avoid raising a NameError on FreeBSD using Date
Conflicts:
	activesupport/CHANGELOG.md
Merge pull request #12759 from dmarkow/backport-9675c7d

Backport relation merger updates from 9675c7d to 4-0-stable
Update the Travis configuration file

Let's update the Rubinius and JRuby versions on Travis to make it gives
more useful feedback.
Merge pull request #13562 from robin850/travis

Update the Travis configuration file
Merge pull request #13557 from gmarik/patch-1

Use `Array#wrap` instead `Array()`
Enable fast_finish in the travis configuration

Since rbx and jruby builds are being allowed to fail lets receive the
build information early enabling this option

See http://about.travis-ci.org/blog/2013-11-27-fast-finishing-builds/

Conflicts:
	.travis.yml
Disable THOR_DEBUG while running generators

Bundler 1.5 enables THOR_DEBUG so that it doesn't fail silently but this
breaks the railties tests as we can't capture the error output. It will
be fixed in Bundler 1.5.2 but until then disable THOR_DEBUG whilst we are
running generators in the railties tests.
Merge pull request #13579 from prathamesh-sonpatki/issue-13552

Fix documentation for end_year option of date_helper [ci skip]

Conflicts:
	actionpack/lib/action_view/helpers/date_helper.rb
Fixed  documentation. [ci skip]
Merge pull request #13590 from kuldeepaggarwal/fix-date-helper-doc

provide correct example of `datetime_select` helper [ci skip]
Show full route constraints in error message

When an optimized helper fails to generate, show the full route constraints
in the error message. Previously it would only show the contraints that were
required as part of the path.

Fixes #13592
Unique the segment keys array for non-optimized url helpers

In Rails 3.2 you only needed pass an argument for dynamic segment once so
unique the segment keys array to match the number of args. Since the number
of args is less than required parts the non-optimized code path is selected.
This means to benefit from optimized url generation the arg needs to be
specified as many times as it appears in the path.

Fixes #12808

(cherry picked from commit 6b548830828e4e910de7854d21717c17303e089c)