after-create

[Rails] counter_cache is stale in after_create hook

I rely on a counter cache value in an after_create hook of my model. However, my hook is called before the counter cache gets updated, thus breaking a computation. Is there any way to force a counter cache "flush" so that I always see an up-to-date value in after_create? ...

Can't grab foreign key during after_create callback because it doesn't exist yet!

I have some models all linked together in memory (parent:child:child:child) and saved at the same time by saving the top-most parent. This works fine. I'd like to tap into the after_create callback of one of the children to populate a changelog table. One of the attributes I need to copy/push into the changelog table is the child's f...

Rails Load Data into Application every time a New User is Created

Hi I am trying to figure out the "right" way to do this. In my application every time I create a new user I want to have specific data loaded into an associated table. The associated table is a different preset lists. So a User has many lists and those lists have many items. Some of those Items I want to be loaded when the User is creat...