Im once again struggling to see the equivalence of two definitions. In my abstract algebra book (abstract algebra by beachy and blair) it says that elements $d_1,d_2,....,d_n \in D$ where $D$ is a UFD is said to be relatively prime in $D$ if there is no irreducible element $p \in D$ such that $p \mid a_i$ for $i=1,2,...n$.
However in my other book (A classical introduction to modern number theory by ireland and rosen) it says that two elements $a$ and $b$ are relatively prime if the only common divisors are units.
I am sure both definitions can not be correct. For instance, suppose that $a_1$ and $a_2$ are relatively prime according to the first definition, then we may very well have the case where a nonunit $p_1$ that is not irreducible divides both $a_1$ and $a_2$, so according to definition 2 the elements are not relatively prime. In this case, the elements are both relatively prime and not at the same time which shows that the definitions are not equivalent.
Am I missing something here or are the authors simply being sloppy?