I’m new to ActiveRecord. I realized that I had forgotten to add a default value for a column in one of my tables. I want to create a migration to fix this, but I can’t figure out how. Is there an alter_column method that you can call during migrations? If not, how can I do it?
EDIT: I just tried using change_column, but this causes an error like this:
— change_column(:carts, :quantity, :integer, {:default=>1})
-> 0.0097s
rake aborted!
An error has occurred, this and all later migrations canceled:
wrong number of arguments (0 for 1)
you can simply do a
change_table:edit: in this case you can use change_column_default