Problem about ideals of the localization of a ring I'm having problems on doing the section (ii) of this exercise. 
Let $R$ be a domain. Let $P$ be a prime ideal of $R$. 
(i) Prove that $S:=R\setminus P$ is a multiplicatively closed system with no zero divisors. Prove that $R_P=S^{-1}R=\{a/b \in K \mid b \not\in P\}$.

(ii) We define $i:R \to R_P$ the homomorphism such that $i(a)=\frac{a}{1}$. Given an ideal $J$ of $R_P$, prove that exists an ideal $I$ of $R$ such that $I \subseteq P$ and such that $i(I)R_P=J$. (Here, $i(I)R_P$ wants to mean the ideal of $R_P$ generated by $i(I)$. (Indication: Consider $I=\{\sum_{i=1}^{n}a_ix_i \mid n \geq 1, \frac{a_i}{1} \in J, x_i \in R\}$.

I've solved the (i) section, but I don't know how to start with (ii). Could anybody help me? 
Thank you very much.
 A: Let $J$ be an ideal of $R_P$. Consider
$$
I=\{x\in R: x/1\in J\}
$$
It's easy to prove that $I$ is an ideal in $R$: obviously $0\in I$; if $x,y\in I$, then
$$
\frac{x+y}{1}=\frac{x}{1}+\frac{y}{1}\in J
$$
and therefore $x+y\in I$; if $x\in I$ and $r\in R$, then
$$
\frac{xr}{1}=\frac{x}{1}\frac{r}{1}\in J
$$
and thus $xr\in I$.
Suppose $x\in I$ and $x\notin P$. Then, by definition, $x/1\in J$; since $1/x\in R_P$, we have that
$$
\frac{1}{1}=\frac{x}{1}\frac{1}{x}
$$
and so $J=R_P$. Since $J$ is a proper ideal (see below), we have a contradiction. Hence $I\subseteq P$.

Note The given hint is too complicated. Also the statement is wrong, because one has to assume that $J$ is a proper ideal, because for no ideal $I$ of $R$, with $I\subseteq P$, we have $i(I)R_P=R_P$.

Let us now show that $i(I)R_P=J$.
Let $x/s\in J$, with $x\in R$ and $s\in R\setminus P$; then
$$
\frac{x}{1}=\frac{x}{s}\frac{s}{1}\in J
$$
so $x\in I$ and so
$$
\frac{x}{s}=i(x)\frac{1}{s}\in i(I)R_P
$$
Hence $J\subseteq i(I)R_P$.
Now suppose
$$
z=\sum_{k=1}^n i(x_k)\frac{r_k}{s_k}\in i(I)R_P
$$
with $x_k\in I$. By definition, $i(x_k)=x_k/1\in J$, so $z\in J$.
A: "Sharp" in his book "Steps in Commutative Algebra" has:  
 
Note that your statement, $I\subseteq P$, is correct when $J$ is proper; by  


He even adds :  

