Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.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 - Fatal编程技术网

Ruby on rails 为什么当我尝试在应用程序中渲染某些内容时,它不会';你不来吗?

Ruby on rails 为什么当我尝试在应用程序中渲染某些内容时,它不会';你不来吗?,ruby-on-rails,Ruby On Rails,我的layouts文件夹中有这个文件名application.html.erb <!DOCTYPE html> <html> <head> <title>One Month Rails</title> <%= stylesheet_link_tag "application", :media => "all" %> <%= javascript_include_t

我的layouts文件夹中有这个文件名
application.html.erb

<!DOCTYPE html>
<html>
    <head>
      <title>One Month Rails</title>
      <%= stylesheet_link_tag    "application", :media => "all" %>
      <%= javascript_include_tag "application" %>
      <%= csrf_meta_tags %>
    </head>
    <body>
        <% render 'layouts/header' %>

        <%= yield %>

        <% render 'layouts/footer' %>

    </body>
</html>
<%= link_to "Home", root_path %>
<%= link_to "About", about_path %>

保存代码并刷新页面后,更改不会发生

您试图创建一个分部,因此必须重命名为
\u header.html.erb
,并将.erb更改为


请阅读rails文档中关于的文档

看起来您至少需要以下文件:

/app/views/layouts/_header.html.erb
/app/views/layouts/_footer.html.erb
我假设您有
根路径
关于路径

的正确路由,而且应该是
。我忘记了“%”后面的“=”。非常感谢你!