Refactor helpers code in Action Pack a bit

* Avoid calling class_eval when not needed
* Remove helpers_path attr accessor, it's defined as a class attribute a
  few lines later
* Avoid creating extra arrays when finding helpers, use flat_map and sort!
* Remove not required refer variable when redirecting :back
Merge pull request #8503 from siong1987/debugger-jruby

Don't include debugger gem if jruby is used since it doesn't work on jruby. [ci skip]
Bring back helpers_path attr accessor

This is apparently used by the railtie to setup the app helpers paths
correctly between initializers. I'll need to check it further.
Add a small note about the compressing the file, and how that helps the application.
Merge pull request #8499 from schneems/schneems/html-route-inspector

Output routes in :html format
Add migration example to Association Basics [ci skip]
Merge pull request #8432 from rmcastil/add_migration_example_to_each_association_type

Add migration examples to Association Basics

[ci skip]
Add missing require.

I was trying to use those files without Rails and that require was
missing.
Fix associations presence lost in steve's reformat

https://github.com/lifo/docrails/commit/55a2820cc6d33e96b8d1b64b38b033913058dce4
messes up
https://github.com/lifo/docrails/commit/cfd324b4b68469ba3188e4b7ba8586e59b239693

Hopefully there is other stuff lost in translation...
Elaborate using `inverse_of` with presence validation
Change method is default since rails 3.1 [ci skip]

Since Rails 3.1, change method is preferred for writing
migrations. Updated the example, because that command
would generate migration with change method.
Replace some global Hash usages with the new thread safe cache.

Summary of the changes:
 * Add thread_safe gem.
 * Use thread safe cache for digestor caching.
 * Replace manual synchronization with ThreadSafe::Cache in Relation::Delegation.
 * Replace @attribute_method_matchers_cache Hash with ThreadSafe::Cache.
 * Use TS::Cache to avoid the synchronisation overhead on listener retrieval.
 * Replace synchronisation with TS::Cache usage.
 * Use a preallocated array for performance/memory reasons.
 * Update the controllers cache to the new AS::Dependencies::ClassCache API.
   The original @controllers cache no longer makes much sense after @tenderlove's
   changes in 7b6bfe84f3 and f345e2380c.
 * Use TS::Cache in the connection pool to avoid locking overhead.
 * Use TS::Cache in ConnectionHandler.
Fix failing test in railties

Related to the HTML route inspector changes:
ae68fc3864e99ab43c18fd12577744e1583f6b64
Revert "Clear url helpers when reloading routes"

This doesn't actually remove old url helper methods as they are
defined in a different module.

This reverts commit 96bcef947bf713b7d9fc88f26dff69f568111262.

Conflicts:
	actionpack/CHANGELOG.md
Clear url helper methods when routes are reloaded

Remove all the old url helper methods when clear! is called on the
route set because it's possible that some routes have been removed.
Removed :if and :unless from fragment cache option in favour of

cache_if(condition, option, &block) and cache_unless(condition, option, &block).

In the PR #8371 was introduced  conditional options :if and :unless in
the cache method.

    Example:

      <%= cache @model, if: some_condition(@model) do %>
        ...
      <%end%>

This is a good feature but *cache_if* and and *cache_unless*
are more concise and close to the standard of rails view helpers
(ex: link_to_if and link_to_unless).

    Example:

      <%= cache_if condition, @model do %>
      ...
      <%end%>
Merge pull request #8497 from acapilleri/conditional_cache

Removed :if / :unless conditions to fragment cache in favour of *cache_i...
Fix for has_many_through counter_cache bug

This commit fixes reported issue #7630 in which counter
caches were not being updated properly when replacing
has_many_through relationships
Improve the documentation of cache_if and cache_unless
Merge pull request #8400 from matthewrobertson/has-many-through-counter-cache

Fix for has_many_through counter_cache bug

Counter caches were not being updated properly when replacing
has_many_through relationships.