latches destroy (ActiveRecord::InvalidForeignKey) "PG::ForeignKeyViolation: ERROR: update or d...

An ActiveRecord::InvalidForeignKey occurred in latches#destroy:

 PG::ForeignKeyViolation: ERROR:  update or delete on table "latches" violates foreign key constraint "fk_rails_bae750b2e0" on table "performed_service_records"
DETAIL:  Key (id)=(831) is still referenced from table "performed_service_records".
: DELETE FROM "latches" WHERE "latches"."id" = $1
 app/controllers/latches_controller.rb:19:in `destroy'


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

 * URL        : https://www.bikelink.org/latches/831
 * HTTP Method: DELETE
 * IP address : 38.126.101.128
 * Parameters : {"_method"=>"delete", "authenticity_token"=>"UCSAqVXVq3evKfCxEjnDh9lQmIigTmrhm/GY/CaG0DRMX23SarqDh/RNTGngP6hzpOgtz/W3yxwoz5P8gSkXwg==", "controller"=>"latches", "action"=>"destroy", "id"=>"831"}
 * Timestamp  : 2020-10-22 03:00:57 UTC
 * Server : www-3.internal.bikelink.org
   * Rails root : /var/www/bikelink
 * Process: 30627

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

 * session id: [FILTERED]
 * data: {"session_id"=>"d91e799691da7fe50d3351f7290b034b",
  "warden.user.person.key"=>[[6607], "7EfEd8l0z0LmONM4GOt6"],
  "params_for_filter"=>
   {:filter_by_location=>nil,
    :filter_by_owner=>nil,
    :filter_by_state=>2,
    :filter_by_priority=>nil},
  "_csrf_token"=>"HHvtez9vKPBbZLzY8gZr9H24tUdV+aH9sz4LAKevx/Y="}

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

 app/controllers/latches_controller.rb:19:in `destroy'
Znovu načíst