How to show a polynomial over a UFD, which is reducible over field of fractions, can be factored over the ring? 
Let $R$ be a UFD, $K$ its field of fractions, $f(x) \in R[x]$, and assume $f(x) = \alpha(x)\beta(x)$ with $\alpha(x), \beta(x)$ in $K[x]$.
Prove that there exists $c \in K^\times$ such that $c\alpha(x) \in R[x]$ and $c^{-1}\beta(x) \in R[x]$.

I have shown this for the case when $\alpha$ and $\beta$ are constant. I found that if $\alpha(x)=a/r$ and $\beta(x)=b/s$ where $\gcd(a,r)=1=\gcd(b,s)$, then taking $r/s$ works. This is because if $ab/rs \in R$, then $s$ must divide $a$ and $r$ must divide $b$ since $\gcd(a,r)=1=\gcd(b,s)$.
However, I'm having trouble showing this in general.


After playing with some examples with $R=\mathbb Z$, I think that if
$$\alpha(x)=\frac{a_0}{r_0}+\frac{a_1}{r_1}x+\cdots + \frac{a_n}{r_n}x^n$$
$$\beta(x)=\frac{b_0}{s_0}+\frac{b_1}{s_1}x+\cdots + \frac{b_m}{s_k}x^m$$
then I believe taking
$$c=\frac{lcm(r_0, r_1, \dots, r_n, b_0, b_1, \dots, b_m)}{lcm(a_0, a_1, \dots, a_n, s_0, s_1, \dots, s_m)}$$
works. But I can't show this.
Any help?
 A: By user$26857$'s comment/solution above:
Let $f(x)=\alpha(x)\beta(x)$ be in $R[x]$ where $\alpha(x),\beta(x) \in K[x]$. Write $\alpha(x)=\dfrac{a}{r}p(x)$, $\beta(x)=\dfrac{b}{s}q(x)$ where $\gcd(a,r)=1=\gcd(b,s)$ and where $p(x), q(x) \in R[x]$ are primitive. For example, if $\deg(\alpha)=n$, then since $R$ is a UFD and $\gcd$'s exist, we have
\begin{align*}
  \alpha(x)&=\frac{a_0}{r_0} + \frac{a_1}{r_1}x + \cdots + \frac{a_n}{r_n}x^n\\
  &=\frac{1}{r_0r_1 \cdots r_n}(a_0r_1\cdots r_n + a_1r_0r_2\cdots r_n x + \cdots + a_nr_0\cdots r_{n-1}x^n)\\
  &=\frac{\gcd(a_0r_1\cdots r_n, \dots, a_nr_0\cdots r_{n-1})}{r_0 r_1 \cdots r_n}p(x)
\end{align*}
and thus $p(x) \in R[x]$ is primitive. Now simplify $\dfrac{\gcd(a_0r_1\cdots r_n, \dots, a_nr_0\cdots r_{n-1})}{r_0 r_1 \cdots r_n}$ if necessary.
So, $$f(x)=\alpha(x)\beta(x)=\frac{ab}{rs}p(x)q(x)$$
and we have $$rsf(x)=abp(x)q(x).$$
Since $p$ and $q$ are primitive, then by Gauss' lemma, $pq$ is primitive. So, $(rs \cdot \mathrm{cont}_f)= (ab)$, where $\mathrm{cont}_f$ is the content of $f(x)$. Therefore $urs \cdot \mathrm{cont}_f= ab$ for some unit $u \in R$. Therefore, $r\mid ab$ and $s \mid ab$. Since $\gcd(a,r)=1=\gcd(b,s)$, then $r\mid b$ and $s\mid a$.
Taking $c=\dfrac{r}{s}$ gives the required $c$.
