Finally solved the bug. ++ is not a part of Rails. += 1 is.