root をロードすると、ヘッダーが表示され、CSS ファイルが正しくロードされますが、別のページ (つまりlocalhost:3000/videos
) に移動すると、shared/header
が表示されず、CSS が壊れています。
同じレイアウトで Rails 3 を使用し、CSS でファイルを共有したところ、正しく表示されました。Rails 4 では、レンダリングと歩留まりに変更は見られません。
ビュー/レイアウト/application.html.haml
!!! 5
%html(lang="en-US")
%head
%title MyFLiX4.0
%meta(charset="UTF-8")
%meta(name="viewport" content="width=device-width, initial-scale=1.0")
= csrf_meta_tag
= stylesheet_link_tag "application"
= javascript_include_tag "application"
= yield :head
%body
%header
= render 'shared/header' # This part does not display in yield
%section.content.clearfix
= render 'shared/messages' # This part does not display in yield
= yield # This part does not load CSS properly
%footer
© 2013 MyFLiX4.0
次のようなパーシャルがあります:
views/shared/_header.html.haml
views/shared/_messages.html.haml
github: https://github.com/yhagio/myflix4.0/tree/master/app/views