シンプルなフォームでAjaxの更新アクションを作成しようとしていますが、なぜブラウザが「パッチ」の代わりに「取得」要求を出したのかわかりません。私の見解ではRails単純なフォームのajax投稿:なぜGETリクエストですか?
私はcertificate_webex
メソッドを持っているコントローラで
= simple_form_for current_user, url: certificate_webex_employee_path(current_user), remote: true, html: { class: 'edit-profile' }, defaults: { label: false } do |f|
.form-body
.form-group.row
.col-md-12{style: 'color: black'}
= f.input_field :webex_certification_code, class: "form-control"
マイroutes.rbを
resources :users, controller: 'employees', path: 'employees', as: 'employees', only: [:index, :edit, :update, :show, :destroy] do
get :performance, on: :collection
member do
patch :certificate_webex
end
end
そしてもちろんを持っています。
私がアクションを提出すると、なぜ「リクエストメソッド:GET」ですか? certificate_webex
メソッドがフォームから呼び出されていません。私は
=form_for current_user, url: certificate_webex_employee_path(current_user), method: :patch, remote: true, html: { class: 'edit-profile' }, defaults: { label: false } do |f|
= f.text_field :webex_certification_code, class: "form-control"
'f.submit'ボタンをクリックするかjavascript/jqueryでカスタマイズしたボタンをクリックしてフォームを送信しますか? – rogelio