ruby-on-railsrubyherokumarkdownbluecloth

Ruby on Rails: BlueCloth gem cannot work in production when deployed to heroku


I'm trying to use the BlueCloth gem in order to parse some markdown for my rails app. I added it to my gem file:

    gem 'BlueCloth'

In my .html.erb views I user the code

    <%=  BlueCloth.new(post.content).to_html.html_safe %>

To render the markdown as html. This works completely fine in my local dev environment, but when I push to heroku, even after running bundle install and restarting the app, accessing the app generates internal server errors.

I get the following error in the logs:

    ActionView::Template::Error (uninitialized constant ActionView::CompiledTemplates::BlueCloth):

I include BlueCloth in the gem file:

source 'https://rubygems.org'

gem 'rails', '3.2.8'

gem 'pg'

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

gem 'devise'
gem 'BlueCloth'

I have also run the command bundle install via the heroku command line.

Thanks for the help!


Solution

  • The issue was that I was using the old version of the BlueCloth gem.

    The old gem is called BlueCloth and the new one is called bluecloth

    Changing the line in my gem file:

        gem 'BlueCloth'
    

    To:

        gem `bluecloth`
    

    Fixed it.

    Thanks.