Learning Ruby on Rails 3.1 - deployment - Error (cs.jpg isn't precompiled)

Hi guys,

I've followed the Agile Web Development with Rails book and I'm up to
deployment. I started a Ubuntu 10.1 LTS server on Amazon EC2 for
testing, got Apache 2, mysql, rvm, ruby 1.9.2, rails 3.1 and phusion
passenger up and running as per the book.

When I come to running the actual site, it says "We're sorry, but
something went wrong."

In production/log, I get this:

  Started GET "/" for at 2011-12-26 22:21:44 +0000
    Processing by StoreController#index as HTML
  Rendered store/index.html.erb within layouts/application (1.2ms)
  Completed 500 Internal Server Error in 3ms

  ActionView::Template::Error (cs.jpg isn't precompiled):
      7: <%# for each product %>
      8: <% @products.each do |product| %>
      9: <div class="entry">
      10: <%= image_tag(product.image_url) %>
      11: <h3><%= product.title %></h3>
      12: <%= sanitize(product.description) %>
      13: <div class="price_line">
    app/views/store/index.html.erb:10:in `block in

I've searched for this and found that someone else had the proposed
solution of running:

  bundle exec rake assets:precompile

This has not worked for me and I get the same result above.

I decided to change the environment to development and the site
actually shows up with no errors, but for some reason Javascript is
now being included twice. When I click add to cart, it ends up adding
two products to cart instead of one, etc. On my local machine, it all
runs fine (of course).

Could someone help explain to me what is wrong here and help point me
in the right direction? Much appreciated.

Thank you,


Does it work without issues in production mode on your local machine?

bundle exec rails s -e production

Also if you are using capistrano for deployment, you need not run “bundle exec rake assets:precompile” explicitly on the production server every time. just uncomment the following line in your Capfile and assets will be pre compiled automatically on cap:deploy

load ‘deploy/assets’

Gautam Pai