2011-12-27 5 views
6

다음은 this tutorial이지만 Redcarpet : Module에 대한 정의되지 않은 메소드`new '는 계속 실패합니다. 내 보석 파일에는 "redcarpet"보석이 있습니다. 실패한 코드의 조각 : Redcarpet이 완전히 API를 변경 같은Redcarpet 2.0.1

Redcarpet.new(@post.content).to_html 
+0

그냥 빠른 점검 ... 당신은 gemfile을 변경 한 후 '번들 설치'를 실행 했습니까? – IAmNaN

답변

14

좋아, 그것은 보인다. 다음은 작동합니다 :

markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, 
    :autolink => true, :space_after_headers => true) 
raw markdown.render(@post_content.content) 
+8

+1 나는 또한 작동하는'markdown.render (@ post_content.content) .html_safe'를 사용하는 것을 선호합니다. 더 이상 '원시'를 사용하는 팬이 아닙니다. – Substantial

관련 문제