title: rails 3.1 can't compile assets on prod due to asset host config
body: <p>My production asset_host config looks like this: </p>
  
  <pre><code>  config.action_controller.asset_host = Proc.new { |source, request| 
      if request.ssl? 
        "#{request.protocol}#{request.host_with_port}" 
      else 
        "#{request.protocol}assets#{(source.length % 4) + 1}.example.com" 
      end 
    } 
  </code></pre>
  
  <p>...which is more or less straight from the docs: </p>
  
  <p><a href="http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html" rel="noreferrer">http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html</a></p>
  
  <p>When I go to assets:precompile, I get this: </p>
  
  <pre><code>$ RAILS_ENV=production bundle exec rake assets:precompile 
  rake aborted! 
  This asset host cannot be computed without a request in scope. Remove 
  the second argument to your asset_host Proc if you do not need the 
  request. 
  </code></pre>
  
  <p>....except that I can't really remove the 2nd arg because I need to 
  know if the request is ssl or not.  That said, I understand that a 
  request isn't present during the rake task to generate the assets.... </p>
  
  <p>So how do I get out of this catch 22?</p>