I'm following this tutorial but it keeps failing saying "undefined method `new' for Redcarpet:Module". I have gem "redcarpet" in my Gemfile. The piece of code that is failing:
Redcarpet.new(@post.content).to_html
Okay, it looks like Redcarpet 2 has completely changed the API. The following works:
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,
:autolink => true, :space_after_headers => true)
raw markdown.render(@post_content.content)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With