I saw this question in an old exam and wondered whether it is true or not (it's a yes or no question). It goes as follows:
Is a commutative Ring $R$ with $1$ indecomposable as an $R$-Module (over itself)?
I came up with the counterexample: $R = \mathbb{F}_2 \times \mathbb{F}_2 $ where $R = \{ (0,0),(1,0) \} \oplus \{ (0,0),(0,1) \}$ However I am wondering whether there are any other examples.
The problem seems to be that submodules of R be Ideals and they are not disjoint (in the sense needed for the sum of two submodules to be direct, so disjoint except for the 0) in most cases which is why their sum would not be disjoint. Is what I wrote even correct and what other examples would there be (except for the $K \times K=R$ ones).
Your example is correct, and is essentially the only kind of example. More generally, if $A$ and $B$ are nonzero rings, then $R=A\times B$ is decomposable as an $R$-module since it is the direct sum of the ideals $A\times\{0\}$ and $\{0\}\times B$.
Conversely, suppose a commutative ring $R$ is decomposable as an $R$-module, so there are nonzero ideals $I,J\subset\mathbb{R}$ such that the map $f:I\times J\to R$ given by $(i,j)\mapsto i+j$ is an $R$-module isomorphism. Note that $I$ and $J$ can themselves be considered as (not necessarily unital) rings, since they are closed under multiplication. I claim that $f$ is then actually a ring isomorphism. To show that $f$ preserves multiplication, we need to show that for $i,i'\in I$ and $j,j'\in J$, then $(i+j)(i'+j')=ii'+jj'$. This follows from the fact that the cross-terms $ij'$ and $ji'$ are both in $I\cap J=\{0\}$. So, $R$ is isomorphic as a ring to a product of two nonzero rings (which then must be unital if $R$ is, since if $(i,j)=f^{-1}(1)$ then $i$ is the unit of $I$ and $j$ is the unit of $J$).
(Note that for noncommutative rings this fails, since then $I$ and $J$ would only be left ideals so $ij'$ would not have to be in $I$ and $ji'$ would not have to be in $J$. For a counterexample, consider a matrix ring $R=M_n(k)$, which is not a product of nonzero rings unless $k$ is, but is always decomposable as an $R$-module if $n>1$ since it is the direct sum of the left ideals $I_j$ consisting of the matrices which are $0$ outside the $j$th column.)