【发布时间】:2011-11-07 03:28:36
【问题描述】:
像 Textile 这样的帖子感觉非常必要,但这让我很头疼。 bundle package 和 bundle install 都工作正常,并确认 RedCloth 设置为最新的稳定版本 (4.2.2)。现在我正在使用 ruby 1.9.2p0 和 rails 3.0.7。
但是,当我尝试运行本地服务器时,我看到:
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
posts_controller 中的第 1 行是 require 'RedCloth'。除了添加 json 格式和私有身份验证方法之外,我没有对基本的 Rails 脚手架进行任何其他更改,这都不应该影响这一点。
我正在使用局部渲染我的帖子。目前看起来是这样的:
<% div_for post do %>
<h2><%= link_to_unless_current h(post.title), post %> </h2>
<%= RedCloth.new(post.body).to_html %>
<% end %>
宝石文件:
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 试图遵循这些说明,顺便说一句:http://www.ruby-forum.com/topic/484752 [我用 ruby 1.9.1 和 1.9.2 都试过了,没有骰子,否则我不会在这里])
TIA :)
【问题讨论】:
标签: ruby ruby-on-rails-3 rubygems redcloth