Я пытаюсь создать действие обновления ajax с простой формой, и я не знаю, почему браузер запускает запрос «получить» вместо «патча».Rails ajax post с простой формой: зачем нужен запрос GET?
На мой взгляд, у меня есть
= 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
И, конечно, в контроллере у меня есть метод certificate_webex
.
Почему, когда я отправляю действие, это «Метод запроса: 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