Closed ybakos closed 9 months ago
ActiveRecord::InvalidForeignKey PG::ForeignKeyViolation
ERROR: update or delete on table "projects" violates foreign key constraint "fk_rails_5f2b1bf9dc" on table "project_photos" DETAIL: Key (id)=(269) is still referenced from table "project_photos".
projects#destroy
https://bda-explorer.herokuapp.com/projects/269
The Project has_many :project_photos is missing its :dependent clause, so a project that has project photos is being prevented from being deleted.
has_many :project_photos
:dependent
Add the :dependent clause.
/cc @nick4rivers
ActiveRecord::InvalidForeignKey PG::ForeignKeyViolation
ERROR: update or delete on table "projects" violates foreign key constraint "fk_rails_5f2b1bf9dc" on table "project_photos" DETAIL: Key (id)=(269) is still referenced from table "project_photos".
projects#destroy
https://bda-explorer.herokuapp.com/projects/269
The Project
has_many :project_photos
is missing its:dependent
clause, so a project that has project photos is being prevented from being deleted.Add the :dependent clause.