Skip to content

Instantly share code, notes, and snippets.

@jpemberthy
Created May 5, 2009 19:55
Show Gist options
  • Save jpemberthy/107158 to your computer and use it in GitHub Desktop.
Save jpemberthy/107158 to your computer and use it in GitHub Desktop.
#Add this line at the end of your environment.rb file
ENV['RAILS_ASSET_ID'] = `git log -1 --pretty=format:"%h"`
#Now ENV['RAILS_ASSET_ID'] has the last commit number and can be used to cache your contents
#In my case Unity3D objects
<script type="text/javascript">
var asset_id = <%= ENV['RAILS_ASSET_ID'].to_json %>
var uniObj = new UnityObject('/unity3d/WebTesis.unity3d' + '?' + asset_id, "Unity3D", "600", "450");
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment