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
This will return false if the DB doesn't exist or if the connection is not active (at least in Rails 4+).
::ActiveRecord::Base.connection_pool.with_connection(&:active?) rescue false