Rotation $x \to x+a \pmod 1$ of the circle is Ergodic if and only if $a$ is irrational

I have a book, Ergodic problems of classical mechanics by Arnold/Avez, and in it they prove that rotation $Tx = x+a \pmod 1$ of the circle $M=\{x \pmod 1\}$ is Ergodic if and only if a is irrational. In it they use an earlier corollary that a system is ergodic if and only if any invariant measurable absolutely integrable function is constant a.e. So the start proof goes like this:

Suppose $a$ is rational, then write $a=p/q$, $p,q$ coprime. Since $e^{2\pi qx}$ is nonconstant and measurable, $T$ is not ergodic.

This is fine, but then how come I can't make a similar argument for irrational $a$? As in: Suppose $a$ is irrational, then $e^{2\pi x/a}$ is nonconstant, and it seems to be measurable and absolutely integrable.

What did I do wrong?

-
$e^{2 \pi i a x}$ doesn't give a well-defined function on the line mod $1$ if $a$ isn't an integer. – Qiaochu Yuan May 9 '12 at 4:38

You mean $e^{2 \pi i q x}$. The point is that this is a nonconstant measurable function on the circle that is invariant under $T$. But if $a \in (0,1)$ is irrational, $e^{2 \pi i x/a}$ is not invariant under $T$: if $Tx = x + a - 1$, as it is when $x + a > 1$, then $$e^{2 \pi i T(x)/a} = e^{2 \pi i (x+a-1)/a} = e^{2 \pi i x/a} e^{-2 \pi i/a} \ne e^{2 \pi i x/a}$$