New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Touching the counter_cultured model #25
Comments
It does sound reasonable. Not trivially easy (because I use Thanks for getting in touch, On Sun, Sep 22, 2013 at 4:30 AM, Giuseppe notifications@github.com wrote:
|
I had forked the project in view of attempting a solution, but this merge is such a treat! |
It would be nice if updating the counters also set the model's updated_at field to the current time, in order to facilitate cache expiration.
Imagine a Category index page listing category names and product counts. These days, it is trivial to perform http caching and/or cache the view using a key that includes the most recent change to the categories.
Now, if I add/remove a product or change a product's category, I also need to touch the affected categories, otherwise the category index will be stale. Normally, you would enforce this like so:
HOWEVER, this is too general, as it will cause the cache to needlessly expire when, for example, I am only editing a product's name or other attribute.
Thus, ideally I would like to be able to say something like:
Does this sound reasonable? I looked at the source, and I understand that you eventually call rails'
update_counters
AR method, so the fix would be a little more involved than I initially hoped...Thanks!
Giuseppe
The text was updated successfully, but these errors were encountered: