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.[]
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.
You know you’ve achieved perfection in design, Not when you have nothing
more to add, But when you have nothing more to take away.
— Antoine de Saint-Exupery
I had the same issue and it was related to not running Rails 1.2. All
examples in the book assume you’re using this version of Rails, not sure
if this will be helpful in your case.