0

我想实现这个简单的形式,但它是在旧的轨道上。有人可以帮我在 Rails 3.2 中转换它吗?

<%= start_form_tag ({:action => 'uploadfile'},:multipart => true) %>
<p><label for="upload_file">Select File</label> : 
<%= file_field 'upload', 'datafile' %></p>
<%= submit_tag "Upload" %>
<%= end_form_tag %>
4

1 回答 1

2
<%= form_for(:upload, :url => { :action => "uploadfile" }, :multipart => true) do |form| %>
  <p><%= form.label :datafile, "Select File" %> :
  <%= form.file_field 'datafile' %></p>
  <%= form.submit "Upload" %>
<% end %>
于 2012-04-15T12:16:56.083 回答