Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RedCloth is breaking my Rails 3 blog

Something like Textile for the posts feels pretty necessary, but this is giving me all kinds of headaches. bundle package and bundle install are both working fine, and confirm that RedCloth is set to the latest stable release (4.2.2). Right now I'm on ruby 1.9.2p0 and rails 3.0.7.

When I try to run a local server, though, I'm seeing:

LoadError in PostsController#index

no such file to load -- RedCloth

...

app/controllers/posts_controller.rb:1:in `<top (required)>'

This error occurred while loading the following files:
   RedCloth

Line 1 in posts_controller is require 'RedCloth'. I haven't made any other changes to the basic Rails scaffold besides adding json formatting and a private authentication method, neither of which should be affecting this.

I'm using a partial to render my posts. It currently looks like this:

<% div_for post do %>
  <h2><%= link_to_unless_current h(post.title), post %> </h2>
  <%= RedCloth.new(post.body).to_html %>
<% end %>

Gemfile:

source 'http://rubygems.org'

gem 'rails', '3.0.7'

gem 'sqlite3'
gem 'rake-compiler'
gem 'RedCloth'

group :development, :test do
  gem 'webrat'
  gem 'rspec'
  gem 'rspec-rails'
end

(rake-compiler is there from an attempt to follow these instructions, btw: http://www.ruby-forum.com/topic/484752 [I tried it with both ruby 1.9.1 and 1.9.2, no dice or else I wouldn't be here])

TIA :)

like image 449
Tracy Cogsdill Avatar asked Aug 30 '11 20:08

Tracy Cogsdill


1 Answers

In your Gemfile, modify this line

gem 'RedCloth'

to

gem 'RedCloth', :require => 'redcloth'
like image 81
Serabe Avatar answered Sep 23 '22 04:09

Serabe