2012-06-08 2 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

파셜 '파일 이름은 밑줄로 시작해야합니다. post 폴더에 _questions.html.erb를 저장해야합니다. 또한 '질문'작업을 정의 할 필요가 없습니다.

+0

thnks .... 작동합니다. – Cyber

+0

문제 없음! 답변을 "수락"하십시오. – cdesrosiers

+0

비슷한 문제가 있습니다 ... .html.erb 확장자를 잊어 버렸습니다. .rb가 작동하지 않습니다. –