This code makes more sense in database.rb...which is still loaded when the gem is loaded