In Dummit and Foote section 10.5, proposition 36 says Let $R$ be a PID. $Q$ be a $R$ module. $Q$ is injective if for all $r\in R$, $rQ=Q.$
$\cfrac{\mathbb{Z}}{4\mathbb Z}$ is injective as $\cfrac{\mathbb{Z}}{4\mathbb Z}$ module but $\bar{2}\cfrac{\mathbb{Z}}{4\mathbb Z}\neq \cfrac{\mathbb{Z}}{4\mathbb Z}$ .
Please tell me what I'm missing.


As your counterexample shows, the proof of this result requires $R$ to be a principal ideal domain, not just a principal ideal ring. Dummit and Foote do not explicitly state this hypothesis where it is used, but it is required for the converse direction of the proof, which implicitly relies on the fact that $R\cong rR$ (as $R$-modules) for any $r\in R\setminus\{0\}$ if $R$ is a pid.
In fact, this latter fact holds in any integral domain, not just in pids. This follows from the "cancellation" rule of integral domains: if $R$ is an integral domain and $r\neq 0\in R$, and $sr=tr$ for some $s,t\in R$, then $s=t$. (To see this, note that $sr=tr\implies (s-t)r=0\implies s-t=0$, since $r$ is assumed nonzero). Because of this, the canonical map $\phi_r:R\rightarrow Rr$ given by $s\mapsto sr$ is injective. $\phi_r$ is also an $R$-module homomorphism (since $\phi_r(st)=str=s(tr)=s\phi_r(tr)$ for any $s,t\in R$), and is surjective by definition, and hence gives an isomorphism from $R$ to $Rr$.
Now, let's return to the case where $R$ is a pid. Dummit and Foote's argument for the implication that $Q\text{ injective}\implies rQ=Q$ for any $r\in R\setminus\{0\}$ runs as follows: if $Q$ is injective, and $q\in Q$, $r\in R\setminus\{0\}$ are arbitrary, then we may define a map $f:Rr\rightarrow Q$ by $f(r)=q$. Since $Q$ is injective, by Baer's criterion this may be extended to a map $F:R\rightarrow Q$, and then $F(1)$ will witness divisibility of $q$ by $r$. (Since $rF(1)=F(r1)=f(r)=q$.)
As you say, the problem is in defining the map $f:Rr\rightarrow Q$. Dummit and Foote are implicitly assuming that, for any $q\in Q$, we may define a map $f:Rr\rightarrow Q$ by extending $r\mapsto q$. This is true if $R$ is a pid. Indeed, in this case we may define a map $\tilde{F}: R\rightarrow Q$ by extending $\tilde{F}(1)=q$ (this is the universal property of free $R$-modules), and then compose with $\phi_r^{-1}$ to get a map $f:=\tilde{F}\circ\phi_r^{-1}:Rr\rightarrow Q$ such that $f(sr)=\tilde{F}(s)=sq$ for any $s\in R$. In particular, $f(r)=q$, as desired.
However, if $R$ is not a pid, then this map $\phi_r$ will not necessarily be invertible, so we can't form this composition and hence the result fails. Indeed, your counterexample shows this, for given (for instance) $q:=\bar{1}\in \mathbb{Z}/4\mathbb{Z}=:Q$, and $r:=\bar{2}\in\mathbb{Z}/4\mathbb{Z}=:R$, there is no way to define a map $f:\bar{2}\mathbb{Z}/4\mathbb{Z}\rightarrow\mathbb{Z}/4\mathbb{Z}$ such that $f(\bar{2})=\bar{1}$.
There is a way to salvage the converse direction of this proposition for more general principal ideal rings, which is with the notion of "divisibility". An $R$-module $Q$ is said to be divisible if $rQ=Q$ for any non-zero divisor $r\in R$. Note that, if $R$ is an integral domain, this coincides with the condition that $rQ=Q$ for any $r\in R\setminus \{0\}$. Now, if $r$ is a non-zero divisor then we do have that $R\cong Rr$, even if $R$ is not an integral domain. (Try going through the proof of this fact yourself; it's essentially identical to the proof above.) Then we can apply the technique above to show that, if $R$ is a principal ideal ring (not necessarily a domain) and $Q$ is an injective $R$-module, then $Q$ is a divisible $R$-module. (Again, try going through these details yourself!)