Tra*_*ill 5 ruby rubygems redcloth ruby-on-rails-3
像纺织这样的帖子感觉非常必要,但这给了我各种令人头疼的问题.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
Run Code Online (Sandbox Code Playgroud)
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 %>
Run Code Online (Sandbox Code Playgroud)
的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
Run Code Online (Sandbox Code Playgroud)
(rake-compiler是试图按照这些说明进行的,顺便说一句:http://www.ruby-forum.com/topic/484752 [我用ruby 1.9.1和1.9.2尝试过,没有骰子或者其他我不会在这里])
TIA :)
在Gemfile中,修改此行
gem 'RedCloth'
Run Code Online (Sandbox Code Playgroud)
至
gem 'RedCloth', :require => 'redcloth'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1890 次 |
| 最近记录: |