added database.yml to git ignore, added nil checks to index

Added database.yml into git ignore for safe keeping. Was getting nil errors in index, so added nil checks for safety.