2013-02-03 14 views
6

में उपयोग किए जाने पर रेंडर करें मैं Syntax Highlighting Revised के लिए रेलस्कास्ट एपिसोड के साथ अनुसरण कर रहा हूं। मैं बहुत की तरह लग रहे करने के लिए अपने 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 

हालांकि, अपने वेब एप्लिकेशन

Routing Error 

uninitialized constant Redcarpet::Render 

Try running rake routes for more information on available routes. 

रिटर्न मैं रेल 3.2.11 उपयोग कर रहा हूँ और Redcarpet रेल कंसोल में ठीक प्रतिक्रिया करता है। मैंने मूल रूप से require 'redcarpet' शामिल नहीं किया है, लेकिन मैंने here पर दिए गए निर्देशों का पालन किया लेकिन इससे मदद नहीं मिली।

उत्तर

7

मैंने अपना Gemfile.lock हटा दिया और bundle install फिर से किया और यह पूरी तरह से काम किया।

+17

बीटीडब्ल्यू यह हो सकता है कि आपको बस अपने सर्वर को पुनरारंभ करने की आवश्यकता हो। यह मेरे लिए मामला था। – callum

+0

मैंने कोशिश की कि कुछ बार और इससे मदद नहीं मिली, लेकिन भविष्य की अजीबता के मामले में मैं सलाह को ध्यान में रखूंगा। :) – sunnyrjuneja

संबंधित मुद्दे