我正在使用 gem remotipart 上传文件。这是我的看法:
<%= form_for @file_upload, :id => "form_feedback_attachment", :url => { :controller => "widgets", :action => "feedback_attachment_upload" }, :html => {:multipart => true} do |f| %>
<td class="rightcol"><%= f.file_field :feedback_attachment, :id => "feedback_attachment_file" %>
<%= f.submit "Upload" %></td>
<% end %>
我的控制器:
@file_upload = FileUpload.new
@file_upload.feedback_attachment = params[:file_upload][:feedback_attachment]
respond_to do |format|
if @file_upload.save
format.js
end
end
但我收到此错误:NoMethodError: nil:NilClass 的未定义方法“名称”。我不知道方法名称来自哪里以及来自哪个类。任何帮助将非常感激。谢谢