I am building a rails app (5.1.1) that has the equivalent of posts and comments linked to them.
Everything seems to be working just fine but when I try to delete a post that has comments I get this error:
PG::ForeignKeyViolation: ERROR: update or delete on table "posts" violates foreign key constraint "fk_rails_5a7b40847a" on table "comments"
DETAIL: Key (id)=(3) is still referenced from table "comments".
: DELETE FROM "posts" WHERE "prototypes"."id" = $1"
The error seems pretty straight forward but I'm really new to rails and postgresql so I'm looking for some help on that!