Simplify handling of defaults/options in button_tag

There's no need to rely on Active Support's Hash#reverse_merge for
simple cases with default values, since we can just merge from the
default rather than reverse merge from the options.

This also avoids the creation of one extra hash object by moving to a
Hash#merge! call.
Use 1.9 style hash on docs [ci skip]
docs, flash message keys are normalized to strings. [ci skip]

This is a follow up to a668beffd64106a1e1fedb71cc25eaaa11baf0c1
Take variants into account when calculating template digests in ActionView::Digestor
Fix for external generators extend Erb::Generators

HAML and probably other generators extend this class and invoke
filename_with_extensions with the old signature (without format).
This makes the second argument optional and defaults it to the #format
method which could be overridden as well.

Closes #14132.
Always return an array from formats so there is no need to wrap it when calling
Do note remove `Content-Type` when `render :body`

`render :body` should just not set the `Content-Type` header. By
removing the header, it breaks the compatibility with other parts.

After this commit, `render :body` will returns `text/html` content type,
sets by default from `ActionDispatch::Response`, and it will preserve
the overridden content type if you override it.

Fixes #14197, #14238

This partially reverts commit 3047376870d4a7adc7ff15c3cb4852e073c8f1da.
Introduce `Rails.gem_version`

This method return `Gem::Version.new(Rails.version)`, suggesting a more
reliable way to perform version comparison.

Example:

    Rails.version #=> "4.1.2"
    Rails.gem_version #=> #<Gem::Version "4.1.2">

    Rails.version > "4.1.10" #=> false
    Rails.gem_version > Gem::Version.new("4.1.10") #=> true
    Gem::Requirement.new("~> 4.1.2") =~ Rails.gem_version #=> true

This was originally introduced as `.version` by @charliesome in #8501
but got reverted in #10002 since it was not backward compatible.

Also, updating template for `rake update_versions`.
Merge pull request #14103 from sikachu/4-1-stable-fix-versioning-task

Introduce `Rails.gem_version`
Merge pull request #14296 from joker1007/fix_rails_guides_about_active_record_default_timezone

Fix guide about `config.active_record.default_timezone` [ci skip]
Merge pull request #14286 from sikachu/4-1-stable-revert-render-body-remove-content-type

Do note remove `Content-Type` when `render :body`
Tests for indifferent access using full_messages_for. Closes #11916
Make sure we clean preview_interceptors

We should make sure we clean preview_interceptors after each test so they dont leaky to the next test
Fix OrderedHash.select to return self instance.

On ruby 2.1.1 the behavior of .select and .reject has changed.
They will return a Hash new instance, so we need to override them to
keep the instance object class.
Merge pull request #14327 from zzak/backport_a94966e

Backport a94966e
Merge pull request #14326 from arthurnn/backport_14318

Make sure we clean preview_interceptors
Move setting :scope_level_resource to resource_scope

Originally with_scope_level was exclusively for managing scope levels with
resources, however it is now used for other things so it makes more sense
to move the responsibility for setting the :scope_level_resource to the
resource_scope method. This eliminates repeatedly setting it to the same
resource as each resource method scope is evaluated.

(cherry picked from commit ed0fb4ae7ea28cf3eecce6ec02650bcffc7c7657)
Only use shallow nested scope when depth is > 1

By tracking the depth of resource nesting we can push the need for nested
shallow scoping to only those routes that are nested more than one deep.
This allows us to keep the fix for #12498 and fix the regression in #14224.

Fixes #14224.

(cherry picked from commit dcc91a04a177466516dac12abc358c590743fa71)
Pull namespace defaults out of the options hash

If a developer has specified either :path or :as in the options hash then
these should be used as the defaults for :shallow_path and :shallow_prefix.

Fixes #14241.

(cherry picked from commit 8711086f5a2e73cd068434a5fafef258ba9f4fe1)
Copy shallow options from normal options when using scope

If the options :shallow_prefix and :shallow_path are not set in the
scope options then copy them from the normal :as and :path options
if they are set.

(cherry picked from commit af4c9b78ff1c967cc1aaef14d34205ef92db8134)