Only use valid mime type symbols as cache keys

CVE-2013-6414
Escape the unit value provided to number_to_currency

Previously the unit values were trusted leading to potential XSS vulnerabilities.

Fixes: CVE-2013-6415
Ensure simple_format escapes its html attributes

The previous behavior equated the sanitize option for simple_format with the
escape option of content_tag, however these are two distinct concepts.

This fixes CVE-2013-6416

Conflicts:
	actionview/lib/action_view/helpers/text_helper.rb
Stop using i18n's built in HTML error handling.

i18n doesn't depend on active support which means it can't use our html_safe
code to do its escaping when generating the spans.  Rather than try to sanitize
the output from i18n, just revert to our old behaviour of rescuing the error
and constructing the tag ourselves.

Fixes: CVE-2013-4491
Deep Munge the parameters for GET and POST

The previous implementation of this functionality could be accidentally
subverted by instantiating a raw Rack::Request before the first Rails::Request
was constructed.

Fixes CVE-2013-6417
Currently, we clear query_cache in cache block finish, even if we may already have cache true.

This commit takes into account the last cache_enabled value, before clearing query_cache.
Merge pull request #11643 from vipulnsward/query_cache_clear

Fix QueryCache to work with nested blocks
Fix bad usage of #select with hash
Fix ActiveRecord::Callbacks sample code [ci skip]

Callback caller class uses `after_initialize`,
but Callback callee defines `after_find`.

Current sample code causes following error.

  NoMethodError: undefined method `after_initialize' for #<EncryptionWrapper:0x007fe4931fa5c0>
Merge pull request #13143 from joker1007/fix_active_record_callbacks_document_bug

Fix ActiveRecord::Callbacks sample code [ci skip]
Use travel_to convention in existing test
Add support for localized date references

Ruby's Date class automatically gives us #yesterday, #today,
and #tomorrow. And ActiveSupport has a handy Time.zone.today
for getting a localized version. But there was no localized
version of #yesterday or #tomorrow. Until now.
fix email regex example code [ci skip]

different from the regex in EmailValidator
Merge pull request #13145 from acapilleri/fix_email_example

fix email regex example code [ci skip]
Merge pull request #12822 from cbartlett/master

Add support for localized date references
Added Date#all_week/month/quarter/year for generating date ranges
Merge pull request #9685 from dimko/patch-2

Added Date#all_week/month/quarter/year for generating date ranges
Changelog improvements [ci skip]
`connection.type_to_sql` returns a `String` for unmapped types.

Closes #13146.

This fixes an error when using:

```
change_colum :table, :column, :bigint, array: true
```
ActiveRecord migration exception message formatting