→ Easy Rails Asset ids with Git

09 March 2008

Stick this in your config/environments/production.rb if you’re deploying with Capistrano 2:

# split into two lines for the blog - feel free to use one line
asset_id = File.read(RAILS_ROOT + '/.git/refs/heads/deploy').chomp
ENV['RAILS_ASSET_ID'] = asset_id