INCLUDE_DATA

Reloading a model during a migration

It’s documented, but I’ve somehow missed it. I was running this migration:

This kept failing with: undefined method `original_name=’ for #<Unit:0×3b61aa4>

After some poking around, comes reset_column_information to the rescue. After adding the columns and before looping, just add Unit.reset_column_information. This will reload the Unit model with the new columns, and all will go well.

0 comments ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment