Rails's `counter_cache` feature would make this much easier.  Also this code should really be in the Like model anyway, because creating a like in the console will mess this up.