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. 
Fix tests, active_authorizer shouldn't include blank values

Fix for a test failing after: 00ff0a6776
fix stylesheet template dir
Merge pull request #6687 from tiegz/3-2-optimizations

ActiveRecord#attributes optimization: minimize objects created
Use each_with_object instead of each here
Remove conditional committed by accident
raise error for pending migration 

can be configured by setting config.active_record.migration. Setting to :page_load will raise an error on each page refresh if there are migrations that are pending. Setting to :page_load is defaulted in development for new applications. 
test errors for pending migrations

App should raise error on page_load
add prompt to 404 & 500 pages to check logs

When new programmers push their code to a production server and receive an error they often don't know to check the logs, this simple reminder will help. Most professional applications have custom error pages so this change shouldn't affect them. The wording of the message should not confuse non-developer visitors.
Fix fragile #assert_queries implementation and usages.

Several tests that passed when run in the order they are loaded
by rake test were failing when run in different sequences due to
problems with the implementation of assert_queries and
assert_no_queries as well as incorrect assumptions made about
how many queries might be executed by a database adapter in
various cases.
removes the obsolete require_association method from dependencies

This is an obsolete method from the very early days,
apparently it was used circa 2004 because STI support
was not smart enough. This method is not public
interface, and we are heading a major version, so
removal seems right.
Merge pull request #6683 from stevecj/fix-fragile-assert-queries

Fix fragile #assert_queries implementation and usages.
Merge pull request #6665 from schneems/schneems/raise-migration-error

Notify A User they Have Pending Migrations 
Use . instead of :: for class methods, add CHANGELOG entries
Merge pull request #6692 from schneems/schneems/something-went-wrong

Add Prompt to 404 & 500 Pages to Check Logs in Production
Build fix broken here 03f2249153ae4d2078646e6796d8b9e5ef747fba
Merge pull request #6694 from arunagw/build_fix_master

Build fix broken here 03f2249153ae4d2078646e6796d8b9e5ef747fba
Fix #6635. We should call Scoping methods, before calling Array methods.