当我加载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
答案 0 :(得分:0)
在app / controllers / videos_controller.rb中,第一行应为
class VideosController < ApplicationController
不是
class VideosController < ActionController::Base