In app/controllers/videos_controller.rb, line one should be
class VideosController < ApplicationController
not
class VideosController < ActionController::Base
Question
When I load root the header displays and CSS files are loaded properly, but when I go to another page (i.e. localhost:3000/videos
), the shared/header
is not displayed and CSS is broken.
When I used Rails 3 with the same layout and shared files with CSS, it displayed properly, what am I missing ? I do not see any changes for rendering and yield in Rails 4.
views/layouts/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
I have partials as follows:
views/shared/_header.html.haml
views/shared/_messages.html.haml
github: https://github.com/yhagio/myflix4.0/tree/master/app/views
Solution
In app/controllers/videos_controller.rb, line one should be
class VideosController < ApplicationController
not
class VideosController < ActionController::Base