Let $A$ be an integral domain. A standard exercise is that $$A = \bigcap_{m\text{ maximal}} A_m$$ where we consider $A$ and $A_m$ as subrings of $A_{\{0\}} = K(A)$. A standard proof is by considering the ideal of denominators.
Assuming I don't know this proof, I may want to write an element in $K(A)$ by $\frac{a}{b}$ and try to prove if $\frac{a}{b} \in A_m$ for all $m$, then $b \mid a$ should hold. The assumption implies that $a \in m$ if $b \in m$ where $m$ is a maximal ideal. One might hope that the last statement implies $b\mid a$ but that's not the case if $a$ and $b$ have nontrivial common divisors, for example, $\frac{4}{2}$.
My question is if there's a way to modify the expression of $\frac{a}{b}$ so this argument can work? I don't know much about general ring theory but I heard that $\gcd(a,b)$ is not well-defined in general. I wonder if there's some useful replacement for this notion?