Tuesday, May 05, 2009

Overriding RAILS_ASSET_ID based on the last git commit number

Lately I've been working with some 3D contents made in Unity3D and having Rails as web support in order to visualize those contents. I had to override the ENV["RAILS_ASSET_ID"] variable value in order to make the contents cacheables between commits changes, I'm using Git as scm, so I wanted to use the last commit number as value for the asset id, (there is another similar post for svn), this is exactly what I did:




The first line gets the last commit number and stores it in the variable, then it can be used to make objects cacheables.

Stylesheets, javascripts, etc ... also will get this asset id as default.

6 comments:

natalia.wandaloop said...
This comment has been removed by a blog administrator.
Asunto: Solicitud Intercambio de Enlaces said...
This comment has been removed by a blog administrator.
Eliot Sykes said...

This plugin might be helpful for tweaking rails asset caching in a different way, would still solve your problem:

http://blog.eliotsykes.com/2010/05/06/why-rails-asset-caching-is-broken/

jpemberthy said...

ah thanks, I'll take a look on your plugin, and see if I can introduce that in the app, I'm pretty sure the plugin is a better way to solve this problem. thanks again!

Peter said...

Pc games free
gta 4 free download

No one said...

yeah

PC games ISO