I've just started learning rails so sorry if the answer to this if fairly obvious.
I've added migrations for posts and categories tables in my app and am now adding a reference to categories in my posts table with a default value of not null using the following line:
add_reference :posts, :category, index: true, foreign_key: true, null: false
however I get the following error on running the migration:
SQLite3::SQLException: Cannot add a NOT NULL column with default value NULL: ALTER TABLE "posts" ADD "category_id" integer NOT NULL
I've tried reading through the api, but couldn't figure out what I am doing wrong.