An ActiveRecord::InvalidForeignKey occurred in trouble_tickets#destroy
An ActiveRecord::InvalidForeignKey occurred in trouble_tickets#destroy:
PG::ForeignKeyViolation: ERROR: update or delete on table "trouble_tickets" violates foreign key constraint "fk_rails_6602195830" on table "low_battery_logs"
DETAIL: Key (id)=(12404) is still referenced from table "low_battery_logs".
: DELETE FROM "trouble_tickets" WHERE "trouble_tickets"."id" = $1
app/controllers/trouble_tickets_controller.rb:28:in `destroy'
-------------------------------
Request:
-------------------------------
* URL : https://bikelink.org/trouble_tickets/12404
* HTTP Method: DELETE
* IP address : 157.131.92.92
* Parameters : {"_method"=>"delete", "authenticity_token"=>"akBkNq2q3LbGJXiIlWxnwSu7Akh2jZdxkza27KG+c01AKepICWJ75+5M16gMFkogt41QFmLLOqerexFSCitnGw==", "controller"=>"trouble_tickets", "action"=>"destroy", "id"=>"12404"}
* Timestamp : 2021-02-19 18:55:43 UTC
* Server : www-4.internal.bikelink.org
* Rails root : /var/www/bikelink
* Process: 2299
-------------------------------
Session:
-------------------------------
* session id: [FILTERED]
* data: {"session_id"=>"e9a2182e5a8057411dddb08bc1ae7819",
"warden.user.person.key"=>[[24632], "u22ZsZ7VK1HZ6er12Usf"],
"_csrf_token"=>"AqTuk4zEwx0PgiiecrWYyENWlLFd94G4avNhA+OGzj0="}
-------------------------------
Backtrace:
-------------------------------
app/controllers/trouble_tickets_controller.rb:28:in `destroy'
Reload