Adding a counter after the fact

I want to add a _count to a couple of my models but this is not a new relationship so the numbers will not start at zero. I have tried just adding an update_attribute to my migration with the current count but for some reason the DB will not take the new number.

Does the _count field have a protection on it so people can not tamper with it? What is the proper way to add a _count field to relationships that already exist in production i.e. is there a Rails way of doing it?

The point of the _count field is to count the number of child objects a specific parent has, so if you were adding a count column now, I'm assuming you'd have to update that column with the correct numbers?

It's just a normal field triggered by am after_filter in rails or something no?

I've never used it, this is just my understanding of it.

John Kopanas wrote: