Reading through a proof that a scheme is locally Noetherian if and only if every open, affine subscheme is induced by a Noetherian ring I came across the following which did not seem as obvious to me as it did to the person writing the proof.
Suppose $X=\mathrm{Spec} \ A$ is an affine scheme, and $U=\mathrm{Spec} \ B$ is an open, affine subscheme. Furthermore, if for some $f\in A$, $X_{f}\subset U$, letting $g$ be the image of $f$ in $B$ (via the restriction map), is it the case that $X_{f}=U_{g}$?
The restriction of $X$ to $U$ is isomorphic to $(\mathrm{Spec} \ B, \mathcal{O}_{\mathrm{Spec} \ B})$, but the associated homeomorphism could be quite complicated, so although $X_{f}$ will be mapped to an open set, I'm not sure why it would necessarily be $U_{g}$. Any help would be much appreciated.