Today I Learned

hashrocket A Hashrocket project

Remove The Default Value On A Column

You have a column on one of your database tables with a default value. You'd like to remove the default value. Removing the default is the same as setting it to nil. You can do this with the ActiveRecord DSL using the change_column_default method.

def change
  change_column_default :users, :age, nil

See the docs for more details.

See More #rails TILs
Looking for help? Hashrocket has been an industry leader in Ruby on Rails since 2008. Rails is a core skill for each developer at Hashrocket, and we'd love to take a look at your project. Contact us and find out how we can help you.