Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.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 4 Rails 4项目中缺少部分_Ruby On Rails 4_Partial_Cocoon Gem - Fatal编程技术网

Ruby on rails 4 Rails 4项目中缺少部分

Ruby on rails 4 Rails 4项目中缺少部分,ruby-on-rails-4,partial,cocoon-gem,Ruby On Rails 4,Partial,Cocoon Gem,在我的简单项目中,我决定使用嵌套形式并将其用于cocoon gem。但在实现它之后,我得到了缺少部分错误,尽管我有一个带有下划线的部分文件。这是我的cocoon逻辑代码: \u form.html.erb ... form_for starts... <div class="row"> <div class="col-md-6"> <h3>Ingredients</h3> <%= f.fields_for

在我的简单项目中,我决定使用嵌套形式并将其用于cocoon gem。但在实现它之后,我得到了缺少部分错误,尽管我有一个带有下划线的部分文件。这是我的cocoon逻辑代码:

\u form.html.erb

... form_for starts...

<div class="row">
    <div class="col-md-6">
      <h3>Ingredients</h3>
        <%= f.fields_for :ingredients do |ingredient| %>
            <%= render 'ingredients', f: ingredient %>
        <% end %>
        <%= link_to_add_association "Add", f, :ingredients %>
    </div>
  </div>

...submit and cancel buttons...
<div class="nested-fields">
  <%= f.label :name %>
  <%= f.text_field :name %>

  <%= f.label :count %>
  <%= f.text_field :count %>

  <%= f.label :description %>
  <%= f.text_field :description %>
  <%= link_to_remove_association "Remove", f %>
</div>
。。。开始时的表格。。。
成分
…提交和取消按钮。。。
这是我的部分文件\u components.html.erb

... form_for starts...

<div class="row">
    <div class="col-md-6">
      <h3>Ingredients</h3>
        <%= f.fields_for :ingredients do |ingredient| %>
            <%= render 'ingredients', f: ingredient %>
        <% end %>
        <%= link_to_add_association "Add", f, :ingredients %>
    </div>
  </div>

...submit and cancel buttons...
<div class="nested-fields">
  <%= f.label :name %>
  <%= f.text_field :name %>

  <%= f.label :count %>
  <%= f.text_field :count %>

  <%= f.label :description %>
  <%= f.text_field :description %>
  <%= link_to_remove_association "Remove", f %>
</div>


它正在查找一个名为“成分”字段的文件。我假设cocoon提供了链接到添加关联方法,它需要更多的部分。

它正在寻找一个名为“成分”字段的文件。我假设cocoon提供了链接到添加关联方法,它需要更多的部分。

它正在寻找一个名为“成分”字段的文件。我假设cocoon提供了链接到添加关联方法,它需要更多的部分。

它正在寻找一个名为“成分”字段的文件。我假设cocoon提供了链接到添加关联的方法,它需要更多的部分。

将部分文件重命名为_component_fields.html.erb后,它就开始工作了。将部分文件重命名为_component_fields.html.erb后,它将工作。将部分文件重命名为_component_fields.html.erb后,它将工作。将部分文件重命名为_component_fields.html.erb后,它将工作。单数成分,复数字段

谢谢,我的问题解决了,但你知道背后的原因吗?谢谢,我的问题解决了,但你知道背后的原因吗?谢谢,我的问题解决了,但你知道背后的原因吗?谢谢,我的问题解决了,但你知道背后的原因吗?