Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.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 如何在Rails中使用片段显示我的视图?_Ruby On Rails_Ruby_Partial - Fatal编程技术网

Ruby on rails 如何在Rails中使用片段显示我的视图?

Ruby on rails 如何在Rails中使用片段显示我的视图?,ruby-on-rails,ruby,partial,Ruby On Rails,Ruby,Partial,我正在学习Rails,并尝试使用partials来清除代码 当我刷新post/新页面时,我唯一拥有的就是“Créer un文章”。 我的部分表格中没有出现任何内容 我不明白我的错误,我错过了什么吗 以下是我的看法: <h1>Créer un article</h1> <%= render 'form' %> 第一行缺少等号(=),应该如下所示 <%= form_with model: @post do |f| %> 我的坏消息。需要新鲜的眼睛

我正在学习Rails,并尝试使用partials来清除代码

当我刷新post/新页面时,我唯一拥有的就是“Créer un文章”。 我的部分表格中没有出现任何内容

我不明白我的错误,我错过了什么吗

以下是我的看法:

<h1>Créer un article</h1>

<%= render 'form' %>
第一行缺少等号(=),应该如下所示

<%= form_with model: @post do |f| %>

我的坏消息。需要新鲜的眼睛才能看到它!非常感谢。
Started GET "/posts/new" for ::1 at 2019-12-26 17:38:03 +0100
Processing by PostsController#new as HTML
  Rendering posts/new.html.erb within layouts/application
  Rendered posts/_form.html.erb (Duration: 20.7ms | Allocations: 2408)
  Rendered posts/new.html.erb within layouts/application (Duration: 22.8ms | Allocations: 2711)
[Webpacker] Everything's up-to-date. Nothing to do
Completed 200 OK in 40ms (Views: 34.5ms | ActiveRecord: 0.0ms | Allocations: 7669)
<%= form_with model: @post do |f| %>