# Problem with asset timestamps

**URL:** <https://www.ruby-forum.com/t/problem-with-asset-timestamps/170102>\
**Category:** Rails\
**Created:** [June 12, 2009, 9:58am UTC](https://www.ruby-forum.com/t/problem-with-asset-timestamps/170102 "2009-06-12T09:58:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Florent2](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/eada6e/32.png) [@Florent2](https://www.ruby-forum.com/u/Florent2)\
**Post date:** [June 12, 2009, 9:58am UTC](https://www.ruby-forum.com/t/problem-with-asset-timestamps/170102/1 "2009-06-12T09:58:49Z")

</div>

Hello,

(Config: Rails 2.3.2, Ruby 1.8.7, apache 2.2, assets are served from a  
dedicated host specified in ActionController::Base.asset\_host, in the  
filesystem they are stored in a different folder than the RAILS\_ROOT/  
public folder.)

I face a problem with asset timestamps being changed for all my assets  
when just one asset file has changed. Consequently it bursts the cache  
of client browsers for all my assets, whereas I would like that only  
the timestamp of the changed asset file be changed, so that others  
assets are not bursted in the browser caches.

The scenario:

- I change one asset file on my dev machine.
- I deploy the new version of my app to my production server.
- A script automatically updates the assets which have changed, ie in  
my assets folder only the asset file I changed initially has a changed  
modification time.
- But when I reload a page of my app, I see in the page source code  
that the timestamps automatically added by Rails to the asset files  
are updated for all assets, not just for the changed asset

Is it the Rails expected behaviour? If so, is there a workaround to  
have Rails change only the timestamp of the effectively changed asset  
files? If there is no workaround, is there any other strategy to force  
bursting cache of changed assets, whereas preserving the clients cache  
of unchanged assets?

Thanks by advance for your help 🙂

Regards,  
Florent

---

<div class="post-metadata">

**Author:** ![Florent2](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/eada6e/32.png) [@Florent2](https://www.ruby-forum.com/u/Florent2)\
**Post date:** [June 12, 2009, 5:58pm UTC](https://www.ruby-forum.com/t/problem-with-asset-timestamps/170102/2 "2009-06-12T17:58:41Z")

</div>

Florent2 a écrit :

> the timestamp of the changed asset file be changed, so that others  
> are updated for all assets, not just for the changed asset  
> Florent  
> OK, I’ve figured out the cause of my problem. Rails calculates the asset  
> timestamps with the asset files contained in RAILS\_ROOT/public. The  
> mtime of those files are all changed when I deploy my application. To  
> have Rails looks in my specific assets folders directory (different than  
> RAILS\_ROOT/public), I add a deploy task to symlink the RAILS\_ROOT/public  
> to this directory (I could not figure out how to set Rails.public\_path  
> in a config file).
