0

I'm learning Rails and read about using CodeRay to have lovely syntax highlighting in your page. When I use rails server it's fine and everything is hunky dory, but when I try to deploy to Heroku I get the useful "something went wrong" page. According to the logs, ActionView::Template::Error (coderay.css isn't precompiled):. So I want to remove CodeRay from my Rails app for now.

I removed the CSS file, the link in the erb file, CodeRay from my Gemfile, ran bundle install and bundle update for good measure, but I still get the same error.

2012-05-27T07:41:22+00:00 app[web.1]: Completed 500 Internal Server Error in 98ms
2012-05-27T07:41:22+00:00 app[web.1]: 
2012-05-27T07:41:22+00:00 app[web.1]:     2: <html>
2012-05-27T07:41:22+00:00 app[web.1]:     3: <head>
2012-05-27T07:41:22+00:00 app[web.1]: ActionView::Template::Error (coderay.css isn't precompiled):
2012-05-27T07:41:22+00:00 app[web.1]:     5:   <%= stylesheet_link_tag    "application", "coderay", :media => "all" %>
2012-05-27T07:41:22+00:00 app[web.1]:     4:   <title>RG Simms</title>
2012-05-27T07:41:22+00:00 app[web.1]:     6:   <%= javascript_include_tag "application" %>
2012-05-27T07:41:22+00:00 app[web.1]:     7:   <%= csrf_meta_tags %>
2012-05-27T07:41:22+00:00 app[web.1]:     8:   <link rel="/favicon.ico" alt="gentlemanraptor">

Now, this is really weird. I have removed the stylesheet_link_tag to coderay in the html.erb, uninstall the actual gem completely, and deployed to Heroku again, but with the same error.

Currently using the cedar stack and rails 3.2.3.

Am I doing something wrong?

georgebrock
  • 28,393
  • 13
  • 77
  • 72
Tamachan87
  • 277
  • 5
  • 11

2 Answers2

2

You need to tell rails to precompile coderay.css along with your other assets:

# application.rb
config.precompile += %w(coderay.css)

Try that.

If it still doesn't work you probably need to remove the stylesheet link tag to coderay, since it will get bundled with your application.rb during asset precompilation

jakeonrails
  • 1,885
  • 15
  • 37
1

You need to compile your assets locally first.

Take a look here: https://devcenter.heroku.com/articles/rails3x-asset-pipeline-cedar

Try the below before pushing to Heroku.

RAILS_ENV=production bundle exec rake assets:precompile
gabrielhilal
  • 10,660
  • 6
  • 54
  • 81
  • I did that to no avail. The problem now is that even if I alter my html.erb file the changes don't appear on Heroku. It still thinks that the link to CodeRay.css is there when it isn't. – Tamachan87 May 28 '12 at 10:20