How to check if the database exists or not in rails before doing a rake db:setup?
I would like to check if a database already exists before a db:create is being done
Here is a method that checks if the database already exists:
def database_exists? ActiveRecord::Base.connection rescue ActiveRecord::NoDatabaseError false else true end
References