Permalink
Browse files

Adding guard to make sure test database declarations exist before try…

…ing to auto create
  • Loading branch information...
1 parent f497e7a commit 02ef8d20a19f9548800eaefc0ebdf18fbd9a67be @mikel mikel committed Feb 3, 2010
Showing with 2 additions and 2 deletions.
  1. +2 −2 activerecord/lib/active_record/railties/databases.rake
View
4 activerecord/lib/active_record/railties/databases.rake
@@ -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])

0 comments on commit 02ef8d2

Please sign in to comment.