2012-06-08 20 views
6

मैं एक त्रुटि हो रही है:रेल में गुम आंशिक त्रुटि 3

Missing partial post/questions, application/questions with 
{:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. 
Searched in:* "/Users/..../<project name>/app/views" 

मैं index.html.erb के डेटाबेस में सभी पोस्ट प्रस्तुत करना करने की कोशिश की।

मेरा विचार भाग post/index.html.erb है:

<!--html codes --> 

    <%= render 'questions' %> 

नियंत्रक controller/post_controller.rb:

def index 
     @posts=Post.all 
    end 

    def questions 
    end 

questions.html.erb

<%[email protected] do |post| %> 
    <table> 
     <tr> 
      <td> 
       <h2> 
        <%=post.title%> 
       </h2> 
      </td> 
     </tr> 
     <tr> 
      <td> 
       <h3><%=post.body%></h3> 
      </td> 
     </tr> 
     <tr> 
      <td> 
       This Post comes under:<h4><%=post.tag%></h4> 
      </td> 
     </tr> 
    </table> 

उत्तर

17

partials 'फ़ाइल नाम एक अंडरस्कोर से शुरू करना होगा। आपके पास पोस्ट फ़ोल्डर में _questions.html.erb सहेजा जाना चाहिए। इसके अलावा, आपको 'प्रश्न' कार्रवाई को परिभाषित करने की आवश्यकता नहीं है।

+0

thnks .... यह काम करता है। – Cyber

+0

कोई समस्या नहीं! हालांकि उत्तर को "स्वीकार करें"। – cdesrosiers

+0

में भी इसी तरह की समस्या थी ... .html.erb एक्सटेंशन भूल गए। आरआरएल काम नहीं करता है –

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