Let $R$ be a ring with identity. I am trying to show that an $R$-module $A$ is injective if and and only if for every left ideal $L$ of $R$ and every $R$-module homomorphism $g: L \rightarrow A$, there exists an $a \in A$ such that $g(r) = ra$ for all $r \in L$.
I can show that $A$ is injective given that $g(r) = ra$ for all $r \in L$ by extending $g$ to an $R$-module homomorphism $h: R \rightarrow A$, but I am having trouble showing the other direction. Any hints as to why there exists an $a \in A$ such that $g(r) = ra$ for all $r \in L$ given that $A$ is injective?
Let $\tilde g\colon R\longrightarrow A$ be an extension of $ g\colon L\longrightarrow A$ to $R$ and let $r\in L$. We have $$g(r)=\tilde g(r) = \tilde g(r\cdot 1)=r\tilde g(1),$$ so just set $a=\tilde g(1)$.