我正在关注Syntax Highlighting Revised的RailsCasts一集。我更新了我的ApplicationHelper,如下所示:
require 'redcarpet'
module ApplicationHelper
class HTMLwithPygments < Redcarpet::Render::HTML
def block_code(code, language)
Pygments.highlight(code, lexer:language)
end
end
def markdown(text)
renderer = HTMLwithPygments.new(hard_wrap: true, filter_html: true)
options = {
autolink: true,
no_intra_emphasis: true,
fenced_code_blocks: true,
lax_html_blocks: true,
strikethrough: true,
superscript: true
}
Redcarpet::Markdown.new(renderer, options).render(text).html_safe
end
end但是,我的web应用程序返回
Routing Error
uninitialized constant Redcarpet::Render
Try running rake routes for more information on available routes. 我使用的是Rails 3.2.11,Redcarpet在rails控制台中响应良好。我最初没有包含require 'redcarpet',但我遵循了here上的说明,但它没有帮助。
发布于 2013-02-12 04:40:59
我取下我的Gemfile.lock,然后再做一次bundle install,它工作得很好。
https://stackoverflow.com/questions/14670184
复制相似问题