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

Hi guys,

I’ve followed the Agile Web D. 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 74.57.249.6 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:


10: <%= image_tag(product.image_url) %>
11:

<%= product.title %>


12: <%= sanitize(product.description) %>
13:

app/views/store/index.html.erb:10:in block in _app_views_store_index_html_erb___592600891_86859330' app/views/store/index.html.erb:8:in_app_views_store_index_html_erb___592600891_86859330’

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,

Leonard

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 P.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs