Such rings are called Boolean and are unusually rigid. Given any set $X$, a typical example of Boolean ring is $(\mathcal{P}(X), \triangle, \cap, \bar{\bullet},\emptyset, X)$, (also known as rings of sets).
For every $a, b \in R$, you have $(a+b)(a+b)=a+b$. The LHS is
$(a+b)(a+b)=a^2 + ab + ba + b^2$.
But, for every $r \in R$, $r^2 = r$. Thus
$(a+b)(a+b) = a +ab +ba + b = a + b$
i.e., $ab + ba = 0$.
Boolean condition also gives us that, for every $r \in R$,
$r +r = (r+r)(r+r) = r^2 + r^2 +r^2 +r^2 = r +r +r +r$; thus, $r +r = 0$, that is $r = -r$.
Finally, $ab + ba = ab - ba = 0$, i.e., $ab= ba$. $\square$
Try to prove these funny facts:
1. Rings of sets are actually Boolean unital rings.
2. Boolean rings have characteristic $2$.
3. The only Boolean ring that is an integral domain is $\mathbb{Z}/2\mathbb{Z}$.
4. Every prime ideal is actually maximal and every finitely generated ideal is principal.