While trying to do a migration today I received the following message:
#After running a trace (rake db:migrate –trace)
undefined method `to_sym’ for nil:NilClass
This was the migration:
class AddDefaultValuesToFeedbacks 0 change_column :stores, :rating, :decimal, :precision => 8, :scale => 2, :default => 0 end end
Unfortunately this problem also prevented me from performing any other migrations on the table. I attempted deleting all relevant migration files and then re-running them, restarting the server and rolling back to a previous migration – none of which worked.
Eventually I resorted to exporting the dataset, dropping the table via sqlite3 and recreating it. Thankfully this seems to have worked. The only hint I’ve come across that may explain the cause of this problem, other than typos or referring to non-existant columns, is that it can occur if a migration is screwed over before it finishes and fails to rollback properly.
If anyone else has any concrete answers, please let me know in the comments!