title: Rails 3.1 assets not resolving
body: <p><strong>Problem</strong></p>
  
  <p>I have a Rails 3.0.4 app which I upgrade to 3.1.4 following instructions from <a href="http://railscasts.com/episodes/282-upgrading-to-rails-3-1">Railscast video: "Upgrading to rails 3.1"</a>.</p>
  
  <p>Now I have problems with <strong>assets</strong> because they <strong>are not resolved</strong>, giving messages in server log like this:</p>
  
  <pre><code>Started GET "/assets/application.css" for 127.0.0.1 at 2012-04-08 03:57:13 -0500
  Served asset /application.css - 404 Not Found (15ms)
  
  ActionController::RoutingError (No route matches [GET] "/assets/application.css"):
  Rendered /usr/local/rvm/gems/ruby-1.9.2-p318/gems/actionpack-3.1.4/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (14.3ms)
  
  Started GET "/assets/application.js" for 127.0.0.1 at 2012-04-08 03:57:13 -0500
  Served asset /application.js - 404 Not Found (35ms)
  
  ActionController::RoutingError (No route matches [GET] "/assets/application.js"):
  </code></pre>
  
  <p>These files are in <code>assets</code> directory:</p>
  
  <pre><code>$ ls app/assets/*/application*
  app/assets/javascripts/application.js   app/assets/stylesheets/application.css
  </code></pre>
  
  <p>and contains this:</p>
  
  <pre><code>$ cat app/assets/javascripts/application.js
  //= require jquery
  //= require jquery_ujs
  //= require_self
  //= require_tree .
  $ cat app/assets/stylesheets/application.css
  /*
  *= require_self
  *= require_tree .
  */
  </code></pre>
  
  <p>I suppose everything is configured. Here I put some chunks of files:</p>
  
  <ul>
  <li><p><code>Gemfile</code>, contains assets gems required:</p>
  
  <pre><code>group :assets do
    gem 'sass-rails', '~&gt; 3.1.3'
    gem 'coffee-rails', '~&gt; 3.1.0'
    gem 'uglifier'
  end
  </code></pre></li>
  <li><p><code>application.rb</code>, has assets enabled:</p>
  
  <pre><code>config.assets.enabled = true
  config.assets.version = '1.0'
  </code></pre></li>
  <li><p><code>development.rb</code>:</p>
  
  <pre><code>config.assets.compress = false
  config.assets.debug = true
  </code></pre></li>
  <li><p>finally... <code>application.html.erb</code> layout:</p>
  
  <pre><code>&lt;%= stylesheet_link_tag 'application' %&gt;
  &lt;%= javascript_include_tag 'application' %&gt;
  </code></pre></li>
  </ul>
  
  <p><strong>Stage</strong></p>
  
  <p>I am now in <strong>development</strong> environment.</p>
  
  <p><strong>Tests</strong></p>
  
  <ol>
  <li><p>If I request <code>http://localhost:3000/assets/images/rails.png</code>, it throws <code>No route matches [GET] "/assets/images/rails.png"</code>, but file is there:</p>
  
  <pre><code>$ ls app/assets/images/rails.png 
  app/assets/images/rails.png
  </code></pre></li>
  <li><p>Then I execute <code>rake assets:precompile</code>:</p>
  
  <pre><code>$ bundle exec rake assets:precompile
  /usr/local/rvm/rubies/ruby-1.9.2-p318/bin/ruby /usr/local/rvm/gems/ruby-1.9.2-p318/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
  /usr/local/rvm/rubies/ruby-1.9.2-p318/bin/ruby /usr/local/rvm/gems/ruby-1.9.2-p318/bin/rake assets:precompile:nondigest RAILS_ENV=production RAILS_GROUPS=assets
  </code></pre>
  
  <p>Then, execute server (<code>rails s</code>) and request again an image (<code>rails.png</code>):</p>
  
  <pre><code>$ rails s
  =&gt; Booting WEBrick
  =&gt; Rails 3.1.4 application starting in development on http://0.0.0.0:3000
  =&gt; Call with -d to detach
  =&gt; Ctrl-C to shutdown server
  /usr/local/rvm/gems/ruby-1.9.2-p318/gems/actionpack-3.1.4/lib/action_dispatch/http/mime_type.rb:101: warning: already initialized constant PDF
  [2012-04-08 04:53:06] INFO  WEBrick 1.3.1
  [2012-04-08 04:53:06] INFO  ruby 1.9.2 (2012-02-14) [i686-linux]
  [2012-04-08 04:53:06] INFO  WEBrick::HTTPServer#start: pid=16702 port=3000
  
  Started GET "/assets/images/rails.png" for 127.0.0.1 at 2012-04-08 04:53:14 -0500
  Served asset /images/rails.png - 404 Not Found (38ms)
  
  ActionController::RoutingError (No route matches [GET] "/assets/images/rails.png"):
  
  Rendered /usr/local/rvm/gems/ruby-1.9.2-p318/gems/actionpack-3.1.4/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (125.2ms)
  </code></pre></li>
  </ol>
  
  <p>So <strong>What's wrong?</strong>, Am I doing something wrong?</p>