Tuesday, January 19, 2010

Rails Counter Cache requires evil hack

Rails Counter Cache, when it first came out, probably didn't seem to need this hack (see http://railscasts.com/episodes/23-counter-cache-column and http://snipplr.com/view/3283/counter-cache-column/). However, as of 2.3.4, I need to make the counter cache attribute non-readonly; otherwise, the up migration does not set its value properly.