由于我什至无法猜测的原因,我的 rails 应用程序不再工作了。我没有更改 rails 代码中的任何内容,所以我想这可能与浏览器有关。
简单表单,由 Simple_form 生成:
<%= simple_form_for @order, :url => fillparameters_order_path(@order), :remote => true do |f| %>
<%= f.association :aspectRatio, collection: @order.project.aspect_ratios %>
<%= f.input :client_email, :as => :string %>
<%= f.input :soundtrack, :as => :file %>
<%= f.input :project_id, :as => :hidden %>
<%= f.button :submit %>
<% end %>
它生成以下内容:
form id="edit_order_4" class="simple_form edit_order" novalidate="novalidate" method="post" enctype="multipart/form-data" data-remote="true" action="/orders/4/fillparameters" accept-charset="UTF-8"
<input id="order_soundtrack" class="file optional" type="file" name="order[soundtrack]">
<input class="btn" type="submit" value="Send!" name="commit">
当然除了其他输入。
但是在点击提交按钮后,Firebug 控制台和 webrick 日志显示发送的所有内容都是除了我的文件字段之外的任何内容:
Started PUT "/orders/4/fillparameters" for 127.0.0.1 at 2013-08-04 21:00:03 +0900
Processing by OrdersController#fillparameters as JS
Parameters: {
"utf8" => "✓",
"authenticity_token" => "VpddWLzi7Czzl0L+gbd5wVfjbJ1pQnfI53L86BwbH/E=",
"order" => {
"aspect_ratio_id" => "1",
"client_email" => "****@gmail.com",
"project_id" => "1"
},
"commit" => "Send!",
"id" => "4"
}
有什么想法吗,伙计们?