Skip to content
Evgeniy Demin edited this page Nov 25, 2022 · 1 revision

Imagine your model has belongs_to :user. It can happen that the user, it's being belonging to, may not be existing anymore in the database. This could bring bugs and in order to ensure data consistency, you need to have a foreign key constraints in the database.