首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >RedCloth破坏了我的Rails 3博客

RedCloth破坏了我的Rails 3博客
EN

Stack Overflow用户
提问于 2011-08-31 04:32:02
回答 2查看 1.9K关注 0票数 5

像Textile for the posts这样的东西感觉很有必要,但这让我头疼不已。bundle packagebundle install都工作正常,并确认RedCloth设置为最新的稳定版本(4.2.2)。现在我使用的是ruby 1.9.2p0和rails 3.0.7。

但是,当我尝试运行本地服务器时,我看到:

代码语言:javascript
复制
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脚手架做任何其他更改,这两个都不应该影响这一点。

我正在使用片段来呈现我的帖子。它目前看起来是这样的:

代码语言:javascript
复制
<% div_for post do %>
  <h2><%= link_to_unless_current h(post.title), post %> </h2>
  <%= RedCloth.new(post.body).to_html %>
<% end %>

Gemfile:

代码语言:javascript
复制
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我在Ruby1.9.1和1.9.2上都试过了,没有骰子,否则我就不会在这里了)

TIA :)

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-08-31 07:22:07

在Gemfile中,修改此行

代码语言:javascript
复制
gem 'RedCloth'

代码语言:javascript
复制
gem 'RedCloth', :require => 'redcloth'
票数 5
EN

Stack Overflow用户

发布于 2011-08-31 04:59:31

检查像gem --list一样安装的gem

正如我在gemset中看到的,最新的RedCloth版本是4.2.7。请尝试最新版本以备关注。

你绝对不需要在你的控制器中需要任何gem,因为它们已经通过bundle被需要了。

尝试在rails控制台中测试RedCloth是否可用。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7249433

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档