0

我正在尝试创建一张新地图,但到目前为止还没有成功:

undefined local variable or method `f' for #<#<Class:0x007ff46c0b12c0>:0x007ff46d777ba8>

我正在使用回形针。新的页面形式:

<%= form_for @map, :url => maps_path, :html => { :multipart => true } do |form| %>
  <% if @map.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@map.errors.count, "error") %> prohibited this map from being saved:</h2>

      <ul>
      <% @map.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :carname %><br />
    <%= f.text_field :carname %>
  </div>
    <%= form.file_field :map %>
  <div class="field">
    <%= f.label :criticalcomponentlocations %><br />
    <%= f.text_area :criticalcomponentlocations %>
  </div>
  <div class="field">
    <%= f.label :warnings %><br />
    <%= f.text_area :warnings %>
  </div>
  <div class="field">
    <%= f.label :additionalinfo %><br />
    <%= f.text_area :additionalinfo %>
  </div>
  <div class="actions">
    <%= f.submit %>
  </div>

<% end %>
4

1 回答 1

3

由于您将form变量传递给传递给form_for方法的块,因此您应该替换fform.

于 2013-06-15T21:29:52.830 回答