An exercise on tensor product over an integral domain. This post is the natural conclusion of another one (An exercise on tensor product over a local integral domain.).

Let $M$ be a finite module over an integral domain $A$. Let $Q$ be its fraction field. I need to prove:
  $\dim_Q (M \otimes_A Q)$ = maximal number of linearly independent elements in $M$. 

I proved the $\leq$, but I miss the point for $\geq$.
Please, could you help me in some way?
Thanks in advance.
Cheers
 A: Notice that $Q=S^{-1}A$ and $M\otimes_AQ\simeq S^{-1}M$, where $S=A-\{0\}$. 
Choose a basis of $S^{-1}M$ over $S^{-1}A$, say $\{\frac{x_1}{s_1},\dots,\frac{x_n}{s_n}\}$. Let's show that $x_1,\dots,x_n$ are linearly independent over $A$: if $\sum_{i=1}^na_ix_i=0$ (in $M$), then $\sum_{i=1}^n\frac{a_is_i}{1}\cdot\frac{x_i}{s_i}=\frac01$ (in $S^{-1}M$), so $\frac{a_is_i}{1}=\frac01$ in $S^{-1}A$, hence $a_i=0$.
For the converse, let $x_1,\dots,x_m\in M$ be linearly independent over $A$. Then $\frac{x_1}{1},\dots,\frac{x_m}{1}$ are linearly independent over $Q$: if $\sum_{i=1}^m\frac{a_i}{s_i}\cdot\frac{x_i}{1}=\frac01$ then $\sum_{i=1}^m\frac{a_ix_i}{s_i}=\frac01$, so $\frac{\sum_{i=1}^ms_i'a_ix_i}{s}=\frac01$, where $s=\prod_{j=1}^ms_j$ and $s_i'=\frac{s}{s_i}$. Then there is $t\in S$ such that $t(\sum_{i=1}^ms_i'a_ix_i)=0$, so $ts_i'a_i=0$, hence $a_i=0$.
A: As the kernel of the canonical homomorphism $M\to M\otimes Q$ is the torsion submodule of $M$, we may as well suppose $M$ is torsion-free. Under this hypothesis, the canonical map is injective, and a family of vectors $(m_i)$ in $M$ is $A$-free if and only if the family $(m_i\otimes1)$ is $Q$-free. 
As a family $\Bigl(m_i\otimes\dfrac1{s_i}\Bigr)$ of $Q$-free vectors may be replaced by a family $\,(m'_i\otimes1)$ – simply multiply everything by $s=\prod s_i$ – we have that $(m_i)$  is a maximal family of $A$-free vectors $\iff$ $(m_i\otimes 1)$ is a maximal family of $Q$-free vectors.
