Access heroku environment variable in coffeescript file
===

I have a scenario where I want my CoffeeScript file to access an environment variable like an API key value. This works fine locally but it isn't working when I push it up to heroku.

The file is named something like myfile.js.coffee.erb

I am setting the value like this

    api_key = '<%= ENV['SERVICE_API_KEY'] %>'

I know the values are set in heroku and I have triple checked the spelling, etc. I know it is being processed since the resulting JavaScript file looks like this

    var api_key;
    api_key = "";

Is there something I need to do when precompiling my assets where I can tell it to access environment variables? I admit that I am new to CoffeeScript and the Rails asset pipeline. Is there another more accepted way of doing this? I don't want to embed it in the file for obvious reasons.