2014-01-13 99 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