title: Rails asset pipeline not working in production environment?
body: <p>I have recently upgraded an app from Rails 3.0 to 3.1. I have followed any instructions I could find for enabling the asset pipeline but it always fails when in the <strong>production</strong> environment:</p>
  
  <pre><code>&lt;%= javascript_include_tag "application" %&gt;
  </code></pre>
  
  <p>gives me</p>
  
  <pre><code>&lt;script src="/javascripts/application.js" type="text/javascript"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>which is missing a digest and I get the following error:</p>
  
  <pre><code>cache: [GET /javascripts/application.js] miss
  Started GET "/javascripts/application.js" for 127.0.0.1 at 2011-10-03 23:31:36 +0100
  ActionController::RoutingError (No route matches [GET] "/javascripts/application.js"):
  </code></pre>
  
  <p>I've tried variations of these settings in application.rb:</p>
  
  <pre class="lang-rb prettyprint-override"><code>require File.expand_path('../boot', __FILE__)
  
  #require 'rails/all'
  require "action_controller/railtie"
  require "action_mailer/railtie"
  require "active_resource/railtie"
  require "rails/test_unit/railtie"
  
  if defined?(Bundler)
    # If you precompile assets before deploying to production, use this line
    Bundler.require *Rails.groups(:assets =&gt; %w(development test))
    # If you want your assets lazily compiled in production, use this line
    # Bundler.require(:default, :assets, Rails.env)
  end
  
  
  module Blog
    class Application &lt; Rails::Application
      config.autoload_paths += %W(#{config.root}/lib)
      config.encoding = "utf-8"
      config.filter_parameters += [:password]
      config.assets.enabled = true
      config.assets.version = '1.0'
    end
  end
  </code></pre>
  
  <p>and full production.rb (minus some comments)</p>
  
  <pre class="lang-rb prettyprint-override"><code>Blog::Application.configure do
    config.cache_classes = true
    config.consider_all_requests_local       = false
    config.action_controller.perform_caching = true
    config.serve_static_assets = false
    config.assets.compress = true
    config.assets.compile = false
    config.assets.digest = true
    config.i18n.fallbacks = true
    config.active_support.deprecation = :notify
  end
  </code></pre>
  
  <p>I have ran the <code>rake assets:precompile</code> task.</p>
  
  <p>Am I missing any obvious steps?</p>
  
  <p><strong>Edit:</strong> Some additional details:</p>
  
  <p>My assets are in <code>app/assets</code> folder. <code>app/assets/images</code>, <code>app/assets/javascripts</code>, <code>app/assets/stylesheets</code>, etc.</p>
  
  <p>I see my files generated in my <code>public/assets</code> directory with names and digests.</p>
  
  <p><code>app/assets/javascripts/application.js</code> does indeed compile to something like <code>public/assets/application-6ec417a53cb2bdb949966a153a61e7b1.js</code> They end up in the <code>public</code> directory.</p>