An element of the coordinate ring of a variety $k[X]/I$ may be viewed as a function mapping points of the variety $V=V(I)$ to $k$.
Similarly, an element of a ring $a\in R$ may be viewed as a function on $\operatorname{Spec} R$, which maps each $\mathfrak{p}\in\operatorname{Spec}R$ to the residue of $a$ in the fraction field $R_{\mathfrak{p}}/\mathfrak{p}R_{\mathfrak{p}}$.
In the latter case, $a$ isn't actually a function in the strict sense, because its codomain varies from point to point. For example, $x\in\mathbb{R}[x]$ is takes a value in $\mathbb{R}$ at the prime ideal $(x),$ but a value in $\mathbb{C}$ at $(x^2+1)$.
Is there some standard construction that corrects this defect? Do the residue fields all include into a larger field which can be viewed as the single codomain for the function $a$? Or can we assemble the residue fields into a bundle over $\operatorname{Spec}R$ of which $a$ is a section?