Fix AR#method_missing re-dispatching into overwritten attribute methods.

This was happening when a `super` call in an overwritten attribute method
was triggering a method_missing fallback, because attribute methods
haven't been generated yet.

  class Topic < ActiveRecord::Base
    def title
      # `super` would re-invoke this method if define_attribute_methods
      # hasn't been called yet resulting in double '!' appending
      super + '!'
    end
  end
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
Fix header Content-Type: #<Mime::NullType:...> in localized template

This PR fixes #13064 regression bug introduced by the #8085

Now in _process_format when the format is a Mime::NullType nothing is written in self.content_type.
In this way the method Response#assign_default_content_type_and_charset can
write the the default mime_type.
Merge branch 'format_localized_template' of https://github.com/acapilleri/rails

Conflicts:
	actionpack/CHANGELOG.md
Cleanups in comment about conditional
Convert Mime::NullType in a singleton
Introduce a context for rendering fixtures ERB.

Fixture files are passed through an ERB renderer before being read as
YAML. The rendering is currently done in the context of the main object,
so method definitons leak into other fixtures, and there is no clean
place to define fixture helpers.

After this commit, the ERB renderer will use a new subclass of
ActiveRecord::FixtureSet.context_class each time a fixture is rendered.
Merge pull request #13022 from pwnall/fixture_context

Introduce a context for rendering fixtures ERB.
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