An ActiveRecord::InvalidForeignKey occurred in locations#destroy:

An ActiveRecord::InvalidForeignKey occurred in locations#destroy:

 PG::ForeignKeyViolation: ERROR:  update or delete on table "locations" violates foreign key constraint "error_messages_location_id_fkey" on table "error_messages"
DETAIL:  Key (id)=(768) is still referenced from table "error_messages".
: DELETE FROM "locations" WHERE "locations"."id" = $1
 app/controllers/locations_controller.rb:60:in `destroy'


-------------------------------
Request:
-------------------------------

 * URL        : https://bikelink.org/locations/768
 * HTTP Method: DELETE
 * IP address : 98.35.154.160
 * Parameters : {"_method"=>"delete", "authenticity_token"=>"sSJX9XycQH03iJ2O+YFLe1tFOfKIzNgEJ4t8UxYO2jULXFb/ugYoZAt8schzokDzqphiEWAkzYicd36UI5oKow==", "controller"=>"locations", "action"=>"destroy", "id"=>"768"}
 * Timestamp  : 2020-12-21 20:20:31 UTC
 * Server : www-4.internal.bikelink.org
   * Rails root : /var/www/bikelink
 * Process: 29754

-------------------------------
Session:
-------------------------------

 * session id: [FILTERED]
 * data: {"session_id"=>"dec987a15fcfcfba3f853502bb52b9f4",
  "warden.user.person.key"=>[[31069], "sTS8Ej46w_WwHcSCjmQv"],
  "_csrf_token"=>"un4BCsaaaBk89CxGiiMLiPHdW+Po6BWMu/wCxzWU0JY="}

 * HTTP_REFERER                                   : https://bikelink.org/locations/768

-------------------------------
Backtrace:
-------------------------------

 app/controllers/locations_controller.rb:60:in `destroy'

Znovu načíst