Adding guard to make sure test database declarations exist before trying to auto create

This commit is contained in:
Mikel Lindsaar
2010-02-04 10:59:24 +11:00
parent f497e7ad1d
commit 02ef8d20a1

View File

@@ -28,8 +28,8 @@ namespace :db do
desc 'Create the database defined in config/database.yml for the current Rails.env - also makes test database if in development mode'
task :create => :load_config do
# Make the test database at the same time as the development one
if Rails.env == 'development'
# Make the test database at the same time as the development one, if it exists
if Rails.env.development? && ActiveRecord::Base.configurations['test']
create_database(ActiveRecord::Base.configurations['test'])
end
create_database(ActiveRecord::Base.configurations[Rails.env])