Let [Formula: see text] be an odd prime, and [Formula: see text] be an integer such that [Formula: see text]. Using pairwise orthogonal idempotents [Formula: see text] of the ring [Formula: see text], with [Formula: see text], [Formula: see text] is decomposed as [Formula: see text], which contains the ring [Formula: see text] as a subring. It is shown that, for [Formula: see text], [Formula: see text], and it is invertible if and only if [Formula: see text] and [Formula: see text] are units of [Formula: see text]. In such cases, we study [Formula: see text]-constacyclic codes over [Formula: see text]. We present a direct sum decomposition of [Formula: see text]-constacyclic codes and their duals, which provides their corresponding generators. Necessary and sufficient conditions for a [Formula: see text]-constacyclic code to contain its dual are obtained. As an application, many new quantum codes over [Formula: see text], with better parameters than existing ones, are constructed from cyclic and negacyclic codes over [Formula: see text].