title: Rails 3.1 strategy for pre-compiling controller specific JS assets
body: <p>In order to keep controller specific JavaScript logic out of the standard <code>application.js</code> and only have it included by the relevant controller, I'm putting it in its own .js file and including it based on the controller name from the layout like such:</p>
  
  <pre><code>&lt;%= javascript_include_tag "application", params[:controller] %&gt;
  </code></pre>
  
  <p>That works just fine, but when I deploy the app to production (I'm using Capistrano and have a pre-compile task set up), the asset pipeline doesn't precompile any of the controller specific JS files. I presume this is because my actual JavaScript file isn't referenced by require directives in application.js.</p>
  
  <p>How do I deal with this without moving my controller specific JS back to application.js, or explicitly referencing it from application.js?</p>
  
  <p>Is there some way to tell the asset pipeline to pre-compile an additional list files? How could I manually pre-compile a specific file on production?</p>
  
  <p><strong>Update</strong></p>
  
  <p>As it <a href="http://guides.rubyonrails.org/asset_pipeline.html" rel="noreferrer">turns out</a>, you can specify individual files here in your <code>config/environments/production.rb</code>:</p>
  
  <pre><code>config.assets.precompile += %w( achievements.js )
  </code></pre>
  
  <p>...or I just went ahead and capriciously added it for every JavaScript file:</p>
  
  <pre><code>config.assets.precompile += %w( *.js )
  </code></pre>