Is it intended that the AR sum method return nil rather than 0 (int) or 0.0 (float) when no rows match the conditions? This is the result I get using MySQL.
I can't find any mention of this issue in either Trac or the mailing list archives, so I'll make up a patch if there's confirmation this is not the desired behaviour.