After spending some time trying to make a migration work, and having the error message coming back:
You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.[]
I’ve decided to do a google search for the specific problem, as it was working fine with other test migrations.
It turns out that if the migration is not model specific, but a different one (ie trying to add a new column to an existing table), the :int for the column doesn’t work!
It has to be :integer.
Full bug report and the article are here:
Migrations: :integer works, :int doesn’t – datatype discrepancy