vendredi 22 février 2019

Rails ActionController::RoutingError (No route matches [PATCH]

I am trying to create a form where the user would select multiple categories and enrol in all of them at once. I am struggling to understand how this should happen using a custom method add_to_list_de_distrib.

<%= form_for @user, url: url_for(:controller => 'welcome', action: 'add_to_list_de_distrib') do |f| %>
<div class="form-inputs">
<%= f.collection_select(:id, @all_list, :id, :name, {}, multiple: true, autofocus: true, placehodler: true, id: "list_type", :html => {required: true}) %>
</div>
<div class="form-actions ">
<hr>
<%= f.submit "Enrol", class: "btn btn-primary" %>
</div>
<% end %>

I manage to display the form with the collection working. But How do I create the method so that when the user click 'Enrol' it create records in a table for each of the collection item. For now when I simply click on the button, i get : ActionController::RoutingError (No route matches [PATCH] "/en/welcome/add_to_list_de_distrib"): In my routes I do have add_to_list_de_distrib_path GET /welcome/add_to_list_de_distrib(.format)

Aucun commentaire:

Enregistrer un commentaire