like Javid mentioned in the comment I was missing the line to define what is the variable "databases"
Added this:
databases = YAML.load_file("config/database.yml")
Still have some more errors now but as far as this question, that's what was missing.