私はレールが初めてで、新しいプロジェクトを作成しました。 Hamlのindex.html.hamlというビューを正確に作成しました。しかし、これは私がアプリケーションを実行するときに得るソースです。私はHamlで作成したHTMLやタイトルタグも取得しません。最初はソース、2番目は私のHamlファイルの内容です。railsに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