저는 레일을 처음 사용하고 새로운 프로젝트를 만들었습니다. Haml, index.html.haml에서 다음 뷰를 생성했습니다. 그러나 이것은 내가 앱을 실행할 때 얻는 소스입니다. Haml에서 만든 HTML이나 제목 태그도 없습니다. 첫 번째는 소스이고, 두 번째는 내 Haml 파일의 내용입니다.레일 앱에 html 태그가 없습니다
<h2>'All Posts'</h2>
<table id='posts'>
<thead>
<tr>
<th>Post Title</th>
<th>Post Entry</th>
</tr>
</thead>
<tbody></tbody>
<tr>
<td>First Post</td>
<td>Oylesine bir seyler</td>
</tr>
</table>
index.html.haml 파일 :
!!! 5
%html
%head
%title Rotten Potatoes!
= stylesheet_link_tag 'application'
= javascript_include_tag 'application'
= csrf_meta_tags
%body
= yield
내가 여기서 뭔가를 놓치고 있습니까 :
%h2 'All Posts'
%table#posts
%thead
%tr
%th Post Title
%th Post Entry
%tbody
- @posts.each do |post|
%tr
%td= post.title
%td= post.body
이 내가 만든 application.html.haml 파일이?
class MoviesController < ActionController::Base
def index
@movies = Movie.all
end
def show
id = params[:id]
@movie = Movie.find_by_id(id)
end
end
후 관련 컨트롤러 코드를하시기 바랍니다 가리는되는 뷰/레이아웃/application.html.erb 를 제거합니다. –
컨트롤러 코드를 추가했습니다 – eytanfb
레이아웃을 선택하지 않았습니다. 'application.html.haml' 파일은 어디에 있습니까? 그것은'app/views/layouts/application.html.haml'에 있어야합니다. – matt