In the affine case, let $X=Spec A$$X=\text{Spec }A$, $Y=Spec B$$Y= \text{Spec }B$, and $Z=Spec R$$Z= \text{Spec }R$. If you have morphisms $f:Z\rightarrow X$ coming from $\phi:A\rightarrow R$ and $g:Z\rightarrow Y$ coming from $\psi: B\rightarrow R$ (because $Aff$$\text{Aff}$ is anti-equivalent to
$CRing$ $\text{CRing}$), then the pushout $X \coprod_{Z} Y$, gluing $X$ and $Y$ along $Z$ is given by $Spec D$$\text{Spec }D$, where
$D=A\times_{ R} B:=$ { $(a,b) \in A\times B | \phi (a)= \psi (b) $ } $D=A\times_{R} B:=\{(a,b) \in A\times B \mid \phi (a)= \psi (b)\}$.