2014-01-13 64 views
1

林on Rails的4.我有我想要一个页面显示形式对他们每个人的更新字段对象的两个列表如何从数组中创建表单列表?

<div class="row"> 
    <div class="col-md-6 col-md-offset-3"> 
     <h1>Teas</h1> 
     <% @teas.each do |tea| %> 
      <%= form_tag(controller: "teas", action: "update", method: "patch") %> 
       <%= label_tag(:price, tea.name.titleize) %> 
       <%= text_field_tag :price %> 
      <% end %> 
     <% end %> 

     <h1>Mixins</h1> 
     <% @mixins.each do |mixin| %> 
      <%= form_tag(controller: "mixins", action: "update", method: "patch") %> 
       <%= label_tag(:price, mixin.name.titleize) %> 
       <%= text_field_tag :price %> 
      <% end %> 
     <% end %> 
    </div> 
</div> 

当我用这个,我得到一个syntax error, unexpected keyword_end, expecting end-of-input错误。这里有什么问题?

回答

1

好像你已经在形式错过do

<%= form_tag(controller: "teas", action: "update", method: "patch") do %> 
+1

啊......当然是我 – oobie11