rake db:migrate as in Agile Web Development with Rails

Reading Agile Web Development with Rails (2nd edition)
Working with InstantRails on Windows XP Professional Sevice Pack 2

I am trying to run a migration using the command
  rake db:migrate
from the command prompt.

This is the error I'm getting:

rake aborted!
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.[]

Any ideas why is this occurring and how I can solve this?


I had a similar error. In my case, the problem was that I was trying to alter an existing table by adding a foreign key reference to a table that had existing data in it. I had a previous migration that added some test data for me. Specifically, for me, the problem was that I was trying to explicitly add the constraint in MySQL. I removed the constraint and let rails handle the relationship (probably not the best idea, but I am still learning and playing) and the error went away.


There was the exact same thread on here a few days ago....

Upgrading to 1.2 should fix your problems.


Yup, I just ran into this yesterday and it was because I was not
running 1.2.1. Upgrade and you are good to go.