I saw in rails guides that, mentioning foreign key in model doesn’t really create one in db. Is this true with validates_presence_of? Do i need to add the NOT NULL constraint by myself in migration.
P.S When i tried using validates_presence_of in my model, it didn’t actually create a NOT NULL constraint. But I’m just a beginner, so i could be missing the obvious. I’m using mysql db.
No. Adding validates_presence_of does NOT automatically add database constraints, if you want them, you need to add them manually.