Skip to content
This repository
Browse code

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

…ing to auto create
  • Loading branch information...
commit 02ef8d20a19f9548800eaefc0ebdf18fbd9a67be 1 parent f497e7a
Mikel Lindsaar mikel authored

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. +2 2 activerecord/lib/active_record/railties/databases.rake
4 activerecord/lib/active_record/railties/databases.rake
@@ -28,8 +28,8 @@ namespace :db do
28 28
29 29 desc 'Create the database defined in config/database.yml for the current Rails.env - also makes test database if in development mode'
30 30 task :create => :load_config do
31   - # Make the test database at the same time as the development one
32   - if Rails.env == 'development'
  31 + # Make the test database at the same time as the development one, if it exists
  32 + if Rails.env.development? && ActiveRecord::Base.configurations['test']
33 33 create_database(ActiveRecord::Base.configurations['test'])
34 34 end
35 35 create_database(ActiveRecord::Base.configurations[Rails.env])

0 comments on commit 02ef8d2

Please sign in to comment.
Something went wrong with that request. Please try again.