solution verification – $Msubset N$ for $R$-modules $M,N$ if $S_{mathfrak m}^{-1}Msubset S_{mathfrak m}^{-1}N$ for all maximal ideals $mathfrak msubset R$?

Consider the following proposition (with proof) taken from S. Lang’s “Algebraic Number Theory”:

Proposition $mathbf{18}$. Let $A$ be a Dedekind domain and $M,N$ two modules over $A$. If $mathfrak p$ is a prime of $A$, denote by $S_{mathfrak p}$ the multiplicative set $A-mathfrak p$. Assume that $S_{mathfrak p}^{-1}Msubset S_{mathfrak p}^{-1}N$ for all $mathfrak p$. Then $Msubset N$.

Proof. Let $ain M$. For each $mathfrak p$ we can find $x_{mathfrak p}in N$ and $s_{mathfrak p}in S_{mathfrak p}$ such that $a=x_{mathfrak p}/s_{mathfrak p}$. Let $mathfrak b$ be the ideal generated by the $s_{mathfrak p}$. Then $mathfrak b$ is the unit ideal, and we can write

$$1=sum y_{mathfrak p}s_{mathfrak p}$$

with elements $y_{mathfrak p}in A$ all but a finite number of which are $0$. This yields

$$a=sum y_{mathfrak p}s_{mathfrak p}a=sum y_{mathfrak p}x_{mathfrak p}$$

and shows that $a$ lies in $N$, as desired.

My first question is mainly concerned with the emphasised part and my second, more generally, with which of the assumptions of the proposition are necessary.

So, first regarding the emphasised part. From my understanding we consider the ideal

$$I=sum_{mathfrak p} Rs_{mathfrak p}$$

and claim that this ideal is the unit ideal. As far as I can tell this is a consequence of the following observation:

Maximal ideals are in particular prime and hence occur among the $mathfrak p$. Pick any maximal ideal $mathfrak m$ and note that $s_{mathfrak m}in I$ but $s_{mathfrak m}notinmathfrak m$ by definition. Hence $I$ is not contained in any maximal ideal and so has to be the unit ideal (as every proper ideal is contained in some maximal ideal).

Is this the correct way to think about it? I have found similar claims at some other places but never the full argument spelled out (which I have problems to grasp).

On to the second question: what is really needed for this to work? I think Dedekind domain can be drastically weakened to commutative (from what I understand this is not really needed but a subtle detail I do not deem too important for my question) unital ring. The Dedekind assumption is likely due to the book being on Algebraic Number Theory. However, I am also not sure about the assumption on all primes. The argument I gave above only uses the assumption on all maximal ideals (which makes no difference in a Dedekind domain but in general). I know that for a similar theorem equivalence in the cases of all primes and all maximal ideals holds (see here for instance).

So I claim the following from the aforegoing analysis:

Claim. Let $R$ be a commutative unital ring and $M,N$ two modules over $R$. If $mathfrak m$ is a maximal ideal of $R$, denote by $S_{mathfrak m}$ the multiplicative set $Rsetminusmathfrak m$. Assume that $S_{mathfrak m}^{-1}Msubset S_{mathfrak m}^{-1}N$ for all $mathfrak m$. Then $Msubset N$.

It might be possible to reduce this statement to the one I linked earlier (this one) but I am not sure if and how. Also, I could not find a more general reference for Prop. $18$ which makes me wonder. The books on Commutative Algebra and Abstract Algebra I checked did not seem to contain something similar either.

Thanks in advance!