当我加载根时,标题显示和 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