Extract local cache middleware

Extract LocalCache Middleware, so it can requires rack dependencies,
without adding rack dependencies to `AS::Cache::Strategy::LocalCache`.
Merge pull request #14170 from kritik/master

there could be more than 10 nested records
Merge pull request #14179 from arthurnn/14171_backport

[backport] Extract local cache middleware
`ActionDispatch::Head` was replaced by `Rack::Head`. Closes #14191.

See 449039a86d802871b707dfb51ac1ed96d53526f9 for the original commit.
Merge pull request #14182 from mecampbellsoup/fix_typo_in_url_helper_docs

[skip ci] Fixing typo in documentation: actionview/lib/action_view/helpers/url_helper.rb
Merge pull request #14098 from Amit-Thawait/master

Typo fix for unscope [ci skip]
Merge pull request #14099 from robertomiranda/render-text-2-plain

Update Docs in favor to use render plain instead of text option
Fix render plain docs example in AM::Base

The errors were introduced in e220a34e39
Merge pull request #14120 from gregmolnar/guides

change 'assert !' to 'assert_not' in guides [ci skip]
Merge pull request #14131 from kuldeepaggarwal/upgrade-rails-version

update guides to new version of rails 3.2.x, i.e. 3.2.17 [skip ci]
Merge pull request #14193 from ys/patch-1

Add missing parantheses in index_exists?
Optimize getting started guide images, and use png instead of jpg

We noticed the rails gem increased in size between the beta and rc
versions, and the reason is that some guides images were updated but not
properly optimized, and one image changed from png to jpg, way bigger.

Converting the jpg image back to png, and using ImageOptim to optimize
all the images for web view, improves the situation [ci skip].

---

In current master/4-1-stable:

    508K  guides/assets/images/getting_started/

In v4.1.0.beta1:

    268K  guides/assets/images/getting_started/

In 4-0-stable

    328K  guides/assets/images/getting_started/

After the patch:

    260K  guides/assets/images/getting_started/
Merge pull request #14177 from yahonda/skip_tests_if_duplicate_index_not_allowed

Skip test_migrate_revert_add_index_with_name for some databases
Merge pull request #14199 from arthurnn/travis_211

travis s/2.1.0/2.1.1
Fixed STI classes not defining an attribute method if there is a
conflicting private method defined on its ancestors.

The problem is that `method_defined_within?(name, klass, superklass)`
only works correclty when `klass` and `superklass` are both `Class`es.

If both `klass` and `superklass` are both `Class`es, they share the
same inheritance chain, so if a method is defined on `klass` but not
`superklass`, this method must be introduced at some point between
`klass` and `superklass`.

This does not work when `superklass` is a `Module`. A `Module`'s
inheritance chain contains just itself. So if a method is defined on
`klass` but not on `superklass`, the method could still be defined
somewhere upstream, e.g. in `Object`.

This fix works by avoiding calling `method_defined_within?` with a
module while still fufilling the requirement (checking that the
method is defined withing `superclass` but not is not a generated
attribute method).

4d8ee288 is likely an attempted partial fix for this problem. This
unrolls that fix and properly check the `superclass` as intended.

Fixes #11569.

Conflicts:
	activerecord/CHANGELOG.md
let `insert_record` actuall save the object.

`before_add` callbacks are fired before the record is saved on
`has_and_belongs_to_many` assocations *and* on `has_many :through`
associations.  Before this change, `before_add` callbacks would be fired
before the record was saved on `has_and_belongs_to_many` associations, but
*not* on `has_many :through` associations.

Fixes #14144
Remove inclusion of rubysl gem for rbx on generated Gemfile

From #14026:

    Specific rbx-2 to limit testing on Rubinius 2.x (since there will be
    other versions of Rubinius > 2.x soon).

    Also, as of Rubinius 2.2.5, it is no longer necessary to bundle the
    rubysl gem.

This is what Rails master/4.1 supports, so we don't need to add rubysl to
gemfiles anymore.

Conflicts:
	railties/test/generators/app_generator_test.rb
Merge pull request #14149 from tjschuck/bcrypt_gem_rename

Bump version of bcrypt gem
Merge pull request #14105 from twooster/fix-controller-tests

Fix controller test not resetting @_url_options

Conflicts:
	actionpack/CHANGELOG.md
Fix some validators when used on model instance

Now that Validator #setup is called from the initializer, we need a
reference to the model's class to be passed in to allow the validators
to continue functioning when used at the instance level.

Closes #14134.