Consider the universal property for the fraction field of an integer domain:
Let $R$ be a integral domain, $F(R)$, its fraction field, $K$ some field and $f:R\rightarrow K$ a injective homomorphism, i.e. $R$ is embedded via $f$ in $K$. Then there exists a unique homomorphism $g$ such that $g\circ \varepsilon =f$, where $ \varepsilon $ is the map that embeds $R$ in $F(R)$.
Now my question is: Can we drop the requirement that $f$ is injective ? If we do that, the proof I have in mind has to be modified, since in it $g$ is defined as $g(\frac{a}{b})=f(a)f(b)^{-1}$ and the fact that $f$ is injectiv implies that $f(b)$ is nonzero, which is necessary for $f(b)$ to be invertible.
Although I couldn't come up with a new proof where I define my $g$ in a different way, I also couldn't come p with a counterexample, i.e. some $R,K$ and $f$ such that for every homomorphisms $g$ we have $ g\circ \varepsilon \neq f$. And looking through the internet and books makes me think that the "injectiveness" of $f$ is necessary.
EDIT Since I didn't put enough thought to this, as the first comment shows, I'm modifying my question to consider $g$ only as a ring homomorphism.