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.
add convenience methods for checking migrations

if a rails project needs to be migrated ActiveRecord::Migrator.needs_migration? will be true or false if the current version matches the last version. 
The resolver tests fail if the mysql gem is not installed; this breaks
being able to run the sqlite3 tests without that gem. This fix ensures
the tests will only run if the mysql gem is installed.

A better solution might be to move these tests into the per-adapter tests,
and test each adapter's resolver.
Add failing test for 3.2.5  datetime attribute regression
Fix #6591. If a field with timezone isn't changed, we don't call will_change!.
Merge pull request #6619 from kennyj/fix_6591

Fix #6591 Rails 3.2.5 Regression: incorrect _changed? for datetimes
accept a block in button helper.
Fixed the Gemfile when gemspec is skipped in the 'rails plugin new' command
Metal controller doesn't have logger method, check it and then delegate
Merge pull request #6630 from route/logger_in_metal

Metal controller doesn't have logger method, check it and then delegate
Merge pull request #6628 from fredwu/fix_skip_gemspec

Fixed the Gemfile when gemspec is skipped in the 'rails plugin new' command
Merge pull request #6631 from yuki24/use_block_in_button_helper

Accept a block in FormHelper#button
One-liner code for logger in ActionView::Helpers::ControllerHelper
Merge pull request #6632 from route/one_line_code_for_logger

One-liner code for logger in ActionView::Helpers::ControllerHelper