Search code examples
ruby-on-rails-3rails-3-upgrade

How do I get Rails 3.1 to use the new Assets Pipeline?


I've watched Bates's RailsCast "Update to Rails 3.1". I'm upgrading from 3.0.9. I followed all the instructions, apparently rather poorly. But I did create an app/assets directory and the requisite subdirectories, and put my stuff that formerly lived under "public" in there

Then I changed all my explicit includes to:

<%= stylesheet_link_tag :defaults %>
<%= javascript_include_tag :defaults %>

which yields:

<link href="/assets/defaults.css" media="screen" rel="stylesheet" type="text/css" />
<script src="/assets/defaults.js" type="text/javascript"></script>

so apparently I'm off the mark there. Any help is appreciated.


Solution

  • You should have application instead of :defaults:

    <%= stylesheet_link_tag "application" %>
    <%= javascript_include_tag "application" %>
    

    Then make sure your app/assets/stylesheets/application.css and app/assets/javascripts/application.js has the appropriate manifest directives at the top.