Deploying to Heroku: CodeRay is not Precompiled - How to remove?

224 Views Asked by At

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?

2

There are 2 best solutions below

0
On BEST ANSWER

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

1
On

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