2013-06-06 8 views
1

localhost:3000/posts에서 간단한 블로그 게시물을 실행하려고합니다.템플릿에 누락 오류가 있습니다.

페이지에 액세스하려고하면이 오류가 발생합니다.

class PostsController < ApplicationController 
    def index 

    end 
end 

내가 내 c:/Sites/myrubyblog/app/views 디렉토리에 index.html.erb 파일을 가지고, 그래서 이런 일이 왜 확실하지 않다 : 여기
Template is missing 

Missing template posts/index, application/index with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :coffee]}. Searched in: * "c:/Sites/myrubyblog/app/views" 

posts_controller.rb의 코드의 복사본입니다.

누구든지이 문제를 해결하려면 어떻게해야합니까?

+0

주목할 사실 하나; 어떤 이유로 포스트 컨트롤러 디렉토리 이름을 변경해야한다면 뷰 디렉토리 이름이 현재 컨트롤러와 일치하더라도 해당 컨트롤러에 대한 모든보기를 다시 만들어야합니다. 그냥 뭔가 문제가 있었고 재현하여 작업했습니다. – Jbur43

답변

0

posts 폴더 내에서 index.html.erbrubyblog/app/views/posts으로 이동하십시오.

0

index.html.erb 파일은 c:/Sites/myrubyblog/app/views/posts이어야합니다.

0

각 폴더에보기 코드를 배치해야합니다. 귀하의 경우에는

당신은

템플릿은 뷰 파일을 찾을 수없는 경우 오류가 발생없는 c:/Sites/myrubyblog/app/views/posts/ 폴더에 index.html.erb를 배치해야합니다.

관련 문제