2
至於原因,我甚至無法猜測,我的Rails應用程序不能正常工作了。我沒有改變rails代碼中的任何東西,所以我想這可能是關於瀏覽器的東西。HTML表單中後的參數不包含文件數據
簡單的形式,通過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"
}
任何想法,夥計們?