I'm having a trouble in Dummit and Foote's Abstract algebra, section 5 of Chapter 15. For an integral domain $R$ with quotient field $F$, I want to show that for a given open set $U\subseteq \operatorname{Spec} R$
$$\mathcal O(U) = \{ \frac{a}{b} \in F \mid b \notin P \; \;\text{for all}\; P \in U\}.$$
My attempt was to construct a map from $\{ \frac{a}{b} \in F \mid b \notin P \; \;\text{for all}\; P \in U\}$ to $\mathcal O(U)$. Pick $s \in\mathcal O(U)$. Then $U = Xg_1\cup\cdots\cup Xg_k$. Where $s$ maps $Xg_i$ to $\left( \frac{a_i}{g_i^n}\right)$. Since $R$ is an integral domain, $Xg_ig_j = Xg_i\cap Xg_j \neq \emptyset$ for any pair $(i , j)$. So $\left( \frac{a_i}{g_i^n}\right)= \left( \frac{a_j}{g_j^n}\right)$ in $F$. Let $$f = \sum_{i=0}^ng_i^n$$ Then $a_jg_j^nf = \sum_{i=0}^na_ig_j^{2n}$. So $\left(\frac{a_j}{g_j^n}\right)=\left(\frac{a}{f}\right)$, where $a = \sum_{i=0}^na_i$
If I could show $f \notin P$ for all $P \in U$ then this map is surjective. But, I can't proceed any further.... Is my attempt completely wrong? Could anyone please help me? Thanks.