First, you do not need to pass :id to create! , because ActiveRecord automatically handles this, thus :id can be ignored (standard case is assumed).
Secondly, it is not recommended to use the ActiveRecord query constructor during migration, because if the color name of the model is changed, you must have a broken migration. I highly recommend you use pure SQL and execute this query with execute() .
Third, for the #down method #down you should not truncate the table. You must destroy the 4 colors that you created in #up .
Here is how I wrote it:
def down colors = ["FF6633", "93B233", "4D90D9", "C43092"] Color.where(:color => colors).destroy_all end
source share