rails/rails — pull request #16757 by jpcody (2014-08-31 04:18:08+00:00)
Title: Reestablish AR connection after loading current schemas

As of 4.2b1, when doing a `rake db:setup`, schemas are loaded for each environment. Out of the box, this loads schemas for development and test, but it leaves the connection in place for the test environment. This means that the proceeding call to `rake db:seed` will populate the test database instead of development.

I could overwrite this in to ensure the connection `db/seeds.rb`, but it felt incorrect that schemas would be loaded and not return one's previous environment connection.

Looking at 4.1.6, the [load_schema](https://github.com/rails/rails/blob/v4.1.6.rc1/activerecord/lib/active_record/tasks/database_tasks.rb#L159) method that was previously used didn't actually establish connections, so this wasn't an issue.

Pinging @senny as the original author of this code.