Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 缺少轨道主布局_Ruby On Rails_Ruby_Layout_View - Fatal编程技术网

Ruby on rails 缺少轨道主布局

Ruby on rails 缺少轨道主布局,ruby-on-rails,ruby,layout,view,Ruby On Rails,Ruby,Layout,View,我正在使用最新版本的ruby和ROR。 我在app/views/layouts/application.html.erb文件中放置了一些代码。让我们这样说: <html> <head><title>ABC</title></head> <body> <%= yield %> </body> </html> 基础知识 我很难在我的主页(我仅有的一个页面)中显示布局。 主页也是一个.

我正在使用最新版本的ruby和ROR。 我在app/views/layouts/application.html.erb文件中放置了一些代码。让我们这样说:

<html>
<head><title>ABC</title></head>
<body>
  <%= yield %>
</body>
</html>

基础知识
我很难在我的主页(我仅有的一个页面)中显示布局。 主页也是一个.html.erb文件,它包含基本的html和rails命令。我为它创建了控制器,如下所示:

class HomeController < ActionController::Base
  protect_from_forgery
  def index
    #nothing yet
  end
end
class HomeController

可能是什么问题?

HomeController从ActionController::Base继承。使其从ApplicationController继承。那可能会有帮助

改变

 class HomeController < ActionController::Base
class HomeController

class HomeController
tnx。我会在10分钟内接受答案。我从应用程序控制器复制了代码,所以这就是错误的来源。
 class HomeController < ApplicationController