rails/rails — pull request #10962 by joker1007 (2013-06-16 07:23:18+00:00)
Title: Fix uninitialized constant SchemaMigration when schema cache dump exists

If db/schema_cache.dump exists, raise uninitialized constant SchemaMigration

a commit(15ff21a) remove `ActiveRecord::Base.logger.silence`, and so not work autoloading `Active::Base`.
It causes this error.

## details
1. When I access to rails app, rails calls `ActiveRecord::Migration::check_pending!` and it calls `ActiveRecord::Migrator.current_version` via some methods.
2. `ActiveRecord::Migrator.current_version` calls `ActiveRecord::SchemaMigration.table_name` and `ActiveRecord::SchemaMigration.table_name` needs `ActiveRecord::Base`.
3. When `ActiveRecord::SchemaMigration.table_name` autoloads ActiveRecord::Base, `ActiveSupport.on_load` hook is invoked.
4. `ActiveSupport.on_load` hook calls `ActiveRecord::Migrator.current_version`, if db/schema_cache.dump exists.
5. Circular dependency occurs. `ActiveRecord::Migrator -> ActiveRecord::SchemaMigration -> ActiveRecord::Base -> ActiveRecord::Migrator`

This patch fix it.

But the complexity of dependency is left.