Let $R$ be a commutative ring. Can it be the case that for some $a,b \in R$, $(a) = (b)$ but $a \ne bu$ for all units $u \in R$?
Motivation: In an algebra lecture the presenter remarked that if $R$ is an integral domain, $(a) = (b)$ implies $a = bu$ for some unit $u$. This is elementary to show: since $a \in (b)$ and $b \in (a)$ we have $a = bc$ and $b = da$, hence $a = adc$. In an integral domain this implies $cd = 1$, and so by definition $c$ and $d$ are units.)
I then started trying to find an example of a ring where this doesn’t hold. I tried to find such an example in $\mathbb{Z}/n$, but had difficulty... three hours later I proved that this property always holds in $\mathbb{Z}/n$, despite that $\mathbb{Z}/n$ is not in general an integral domain. (I showed $(a) = (b)$ in $\mathbb{Z}/n$ iff $\gcd(a,n) = \gcd(b,n)$, then showed the units of $\mathbb{Z}/p^n$ act transitively on the set of such elements, then used the Chinese remainder theorem.)
I haven’t been able to think of a counterexample, or a proof which doesn’t require $R$ to be an integral domain. A hint would be much appreciated (I’d rather not have a spoiler).