...私は私のAjaxフォームの送信に問題が生じていますレールAJAXフォーム送信が更新
を発行します。ルーティングの問題か、おそらくUJSの問題かどうかは不明です。 (jQueryの1.6.1と最新のjqueryの - UJSを使用して)
これは、更新アクションフォームが
を投稿するだけでなく有効ですが、おそらく冗長なアクションフォームを作成<form method="post" id="new_product_pressing" data-remote="true" class="simple_form product_pressing" action="/products/my_product_id/product_pressings" accept-charset="UTF-8">
<input type="hidden" value="✓" name="utf8">
<input type="hidden" value="blablablatokenblablabla" name="authenticity_token">
<label for="product_pressing_total_pressed">Total pressed</label>
<input type="text" size="5" required="required" name="product_pressing[total_pressed]" id="product_pressing_total_pressed"
<input type="submit" value="Create Pressing" name="commit" id="product_pressing_submit">
</form>
に対して生成されたHTMLです
私のルートは以下のとおりです。createアクションのための
resources :products, :shallow => true do
resources :product_pressings, :as => :pressings, :only => [:create, :update]
end
product_pressings POST /products/:product_id/product_pressings(.:format) {:action=>"create", :controller=>"product_pressings"}
pressing PUT /product_pressings/:id(.:format) {:action=>"update", :controller=>"product_pressings"}
...ログが示しています
Started POST "/products/product-057/product_pressings" for 127.0.0.1 at...
Processing by ProductPressingsController#create as JS
Parameters: {"product_id"=>"my_product_id"}
リモートtrueを削除すると、"product_pressing"=>{}
のパラメータは渡されますが、remote => trueは渡されません。更新用
...
Started POST "/product_pressings/4e01ad24e1607cc46100008e" for 127.0.0.1 at...
ActionController::RoutingError (No route matches "/product_pressings/4e01ad24e1607cc46100008e"):
は、ルーティングエラーをスローしていても、その番組のような真=>遠隔ことなく正確なURLおよび方法。これは動作していましたが、いつ停止したのかわかりませんが、何が原因でこの動作が起こるのか分かりません。
これは作成または更新アクションですか?新しい/編集フォームの両方で同じように機能しますか? – tamersalama
csrfトークンが見つかりません... – apneadiving