The purpose of this paper is to study a further connection between linear codes over three kinds of finite rings and Hermitian lattices over a complex quadratic field $$K={\mathbb {Q}}(\sqrt{-\ell })$$K=Q(-l), where $$\ell >0$$l>0 is a square free integer such that $$\ell \equiv 3 \pmod {4}.$$l?3(mod4). Shaska et al. (Finite Fields Appl 16(2): 75---87, 2010) consider a ring $${\mathcal {R}}=\mathcal{O}_K / p \mathcal{O}_K$$R=OK/pOK (p is a prime) and study Hermitian lattices constructed from codes over the ring $${\mathcal {R}}$$R. We consider a more general ring $${\mathcal {R}}=\mathcal{O}_K / p^e \mathcal{O}_K$$R=OK/peOK, where $$e \ge 1$$e?1. Using $$p^e$$pe allows us to make a connection from a code to a much larger family of lattices. That is, we are not restricted to those lattices whose minimum norm is less than p. We first show that $${\mathcal {R}}$$R is isomorphic to one of the following three non-isomorphic rings: a Galois ring $$GR(p^e, 2)$$GR(pe,2), $$ {\mathbb {Z}}_{p^e} \times {\mathbb {Z}}_{p^e}$$Zpe×Zpe, and $${\mathbb {Z}}_{p^e} + u {\mathbb {Z}}_{p^e}$$Zpe+uZpe. We then prove that the theta functions of the Hermitian lattices constructed from codes over these three rings are determined by the complete weight enumerators of those codes. We show that self-dual codes over $${\mathcal {R}}$$R produce unimodular Hermitian lattices. We also discuss the existence of Hermitian self-dual codes over $${\mathcal {R}}$$R. Furthermore, we present MacWilliams' relations for codes over $${\mathcal {R}}$$R.