Permalink
Browse files

initialize databases in db:load_config, not in environment

some db tasks such like db:create and db:drop will invoke
db:load_config for db initialization.
  • Loading branch information...
1 parent 75f11c3 commit 7076d6b4b83029d20c92f18a74eac4b14dacafca Yamashita Yuu committed May 25, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/tasks/standalone_migrations.rb
@@ -53,14 +53,17 @@ def s.load_seed
task(:rails_env){}
-task(:environment) do
- ActiveRecord::Base.configurations = standalone_configurator.config_for_all
+task(:environment => "db:load_config") do
ActiveRecord::Base.establish_connection standalone_configurator.config_for Rails.env
end
load 'active_record/railties/databases.rake'
namespace :db do
+ task :load_config do
+ ActiveRecord::Base.configurations = standalone_configurator.config_for_all
+ end
+
desc "Create a new migration"
task :new_migration do |t|
unless migration = ENV['name']

0 comments on commit 7076d6b

Please sign in to comment.