Fix GH #4259. We must remove table_name_prefix and table_name_suffix, when we execute schema dumper.
Prevent concurrent compilation of templates - closes #6400

This addresses an issue where in multi-threaded environments
multiple threads can attempt to compile a template at the same time,
which occasionally causes particular templates to end up in a bad
state.

So, add synchronization such that only a single thread can attempt to
compile a template at one time.
Make the Resolver template cache threadsafe  - closes #6404

The Template cache in the Resolver can be accessed by multiple threads
similtaneously in multi-threaded environments. The cache is implemented
using a Hash, which isn't threadsafe in all VMs (notably JRuby).

This commit extracts the cache to a new Cache class and adds mutexes to
prevent concurrent access.
More granular locking of the Resolver template cache

In order to avoid holding a global lock when doing template
resolution, instead add individual locks on a per cache entry
basis. The global lock is now only used for manipulation of the main
cache data structure.
Improve the readability of the Resolver change detection code
Cache metadata in advance to avoid extra sql statements while testing.

Reason: If metadata is not cached extra sql statements
will be executed, which causes failures tests with assert_queries().
Make connection pool fair with respect to waiting threads.

The core of this fix is a threadsafe, fair Queue class.  It is
very similar to Queue in stdlib except that it supports waiting
with a timeout.

The issue this solves is that if several threads are contending for
database connections, an unfair queue makes is possible that a thread
will timeout even while other threads successfully acquire and release
connections.  A fair queue means the thread that has been waiting the
longest will get the next available connection.

This includes a few test fixes to avoid test ordering issues that
cropped up during development of this patch.
Fix typo [ci skip]
predicate builder should not recurse for determining where columns.
Thanks to Ben Murphy for reporting this

CVE-2012-2661
Strip [nil] from parameters hash.
Thanks to Ben Murphy for reporting this!

CVE-2012-2660
update ActiveModel::Dirty documentation
Add code statistics for Javascript and

CoffeeScript files to `rake stats` task

Orignal PR was #2270

Thanks to @nfm
Simplify logic to initialize valid conditions in RouteSet

Remove :to_sym call from public_instance_methods iteration, as such
methods in Ruby 1.9 already return symbols. Initialize valid conditions
with controller/action instead of setting them afterwards.
Make button_to arguments explicit and refactor a bit

Prefer Hash#[]= over Hash#merge when setting a value.
Make link_to arguments explicit
Simplify link_to using content_tag

Add some tests for link_to with blocks and escaping content.
Fix wrong example for count method with block [ci skip]

Thanks @splattael.
Fix changelog example for count method with block [ci skip]

Missed that too, thanks again @splattael.
Merge pull request #6566 from arunagw/add-javascripts-to-rake-stats-task

Add code statistics for Javascript and CoffeeScript files
Reduce warning messages when running Active Support tests

Eliminate the warnings generated by redefining methods and constants.