我在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
错误。这有什么不对?
答案 0 :(得分:1)
好像你错过了表单上的do
<%= form_tag(controller: "teas", action: "update", method: "patch") do %>