Fix secret key deletion when a rails API is removed