# Controller Action - Publish Automation

**URL:** <https://www.ruby-forum.com/t/controller-action-publish-automation/178318>\
**Category:** Rails\
**Created:** [November 2, 2009, 8:06pm UTC](https://www.ruby-forum.com/t/controller-action-publish-automation/178318 "2009-11-02T20:06:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![leoncelot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/58f4c7/32.png) [@leoncelot](https://www.ruby-forum.com/u/leoncelot)\
**Post date:** [November 2, 2009, 8:06pm UTC](https://www.ruby-forum.com/t/controller-action-publish-automation/178318/1 "2009-11-02T20:06:57Z")

</div>

I am storing the product, tip and post in Rails built in Cache at the  
site [www.onebeautyproduct.com](http://www.onebeautyproduct.com). Currently I have built a button in the  
administration that says “publish today’s events” which essentially  
deletes and stores todays events.

I have tried using Cron but it doesn’t work with cache and it only works  
with a Model’s methods. Anyone have a recommendation on how to do this?

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![leoncelot](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/58f4c7/32.png) [@leoncelot](https://www.ruby-forum.com/u/leoncelot)\
**Post date:** [November 3, 2009, 5:17am UTC](https://www.ruby-forum.com/t/controller-action-publish-automation/178318/2 "2009-11-03T05:17:34Z")

</div>

> I have tried using Cron but it doesn’t work with cache and it only works  
> with a Model’s methods. Anyone have a recommendation on how to do this?

Hmm… what type of caching do you use?

I use fragment caching, and each model clears its own cache items  
whenever it receives an update of data shown in one type of cache or  
another. The ‘show’ cache is always invalidated, the other four cached  
views depend on whether the data for that view was changed or not.

Shouldn’t be difficult to adapt that to a method called when a model  
instance is ‘deleted and stored’, depending on how your caching is  
setup.
