title: Rails asset paths missing fingerprint in production
body: <p>We've just deployed a Rails 4.0.3 app to production and have found that asset paths generated by <code>stylesheet_link_tag</code> and <code>javascript_link_tag</code> are missing their fingerprints. So instead of requesting something like <code>application-c841bd1c82c25bb1de8452d2338479f7.js</code>, the page is just request <code>application.js</code>.</p>
  
  <p><code>RAILS_ENV=production bundle exec rake assets:precompile</code> is successful and generates fingerprinted files.</p>
  
  <p>The bits from <code>config/environments/production.rb</code> that seem relevant are:</p>
  
  <pre><code># Compress JavaScripts and CSS
  config.assets.compress = true
  
  # Don't fallback to assets pipeline if a precompiled asset is missed
  config.assets.compile = false
  
  # Generate digests for assets URLs
  config.assets.digest = true
  
  # Disable Rails's static asset server (Apache or nginx will already do this)
  config.serve_static_assets = false
  </code></pre>
  
  <p>This is running on our own Apache server, not Heroku. I've looked around quite a bit and found similar problems, but none of the troubleshooting steps for those are helping here. Thanks.</p>
  
  <p><strong>More Information</strong></p>
  
  <p>In case it is helpful, here are the full contents (commented lines removed) of our config files:</p>
  
  <p><code>application.rb</code></p>
  
  <pre><code>require File.expand_path('../boot', __FILE__)
  
  require 'rails/all'
  
  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 Ctrc
    class Application &lt; Rails::Application
      config.ceal.application_title = "CTRC Budgeting"
  
      config.encoding = "utf-8"
  
      config.filter_parameters += [:password]
  
      config.active_support.escape_html_entities_in_json = true
  
      config.assets.enabled = true
      config.assets.version = '1.0'
  
      config.pmacs_redmine.project_identifier = 'itmat-gcrc'
  
      config.app_data_path = '/data/web/apps/itmat/ctrc'
      config.paperclip_defaults = {
        path: "/data/web/apps/itmat/ctrc/:attachment/:id/:style/:basename.:extension"
      }
  
      if ENV['RAILS_RELATIVE_URL_ROOT']
        config.assets.prefix = ENV['RAILS_RELATIVE_URL_ROOT'] + '/assets'
      end
    end
  end
  </code></pre>
  
  <p><code>production.rb</code></p>
  
  <pre><code>Ctrc::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
  
    config.eager_load = true
  
  end
  </code></pre>
  
  <p>I know that the application is running in production mode because if I set</p>
  
  <pre><code>config.assets.compile = true
  </code></pre>
  
  <p>in that file, the CSS and JavaScript are compiled and requested correctly.</p>
  
  <p>I'm including those assets in the page  like so:</p>
  
  <pre><code>&lt;%= stylesheet_link_tag    "application", media: "all" %&gt;
  &lt;%= javascript_include_tag "application" %&gt;
  </code></pre>
  
  <p>but it is still generating links to those assets like this:</p>
  
  <pre><code>&lt;link href="/apps/itmat/ctrc/stylesheets/application.css" media="all" rel="stylesheet"&gt;
  &lt;script src="/apps/itmat/ctrc/javascripts/application.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>instead of the fingerprinted links I would expect to see.</p>