Q:

No route matches [PATCH]

I'm attempting to submit a form but am running into the error

No route matches [PATCH]

I've seen a variety of posts on this error but but in each one they only set get in their routes or some such error.  I've also had no problem submitting other forms with nearly identical routing and form structure.
So first, Security has_many :stockholders
My Form is as follows (location: views/stockholders/edit.html.erb):
<%=  simple_form_for @stockholder, url: url_for{action:'update', controller:"stockholders"}, html: {id:"stockholderform"}, update: { success: "response", failure: "error"} do |f| %>
    <div class="container">
        <div class="symegrid">
            <div class="form-inline">
                <%= f.grouped_collection_select :entity_id, [Org, Person], :all, :model_name, :to_global_id, lambda {|org_or_person_object| org_or_person_object.instance_of? Org? rescue org_or_person_object.fname + " " + org_or_person_object.lname rescue org_or_person_object.name}, label:"Stockholder", class: "names"%>
            </div>
            <div class="form-inline">
                <%= f.input :cert_number, label:"Certificate Number" %>
                <%= f.input :issue_date, Label: "Issue Date" %>
            </div>
        </div>
        <div class="submit_button">
        <%= f.submit %>
        </div>
    </div>
<% end %>

And my controller is:
class StockholdersController < ApplicationController
    def edit
        @stockholder=Stockholder.find(params[:id])
        @security=Security.find(params[:security_id])
        @company=@security.company
    end

    def update
        @stockholder=Stockholder.find(params[:id])
        @security=Security.find(params[:security_id])
        @company=@security.company
        if @stockholder.update(stockholder_params)
            redirect_to edit_security_path(@security)
        else
            redirect_to edit_security_stockholder_path
        end
    end

    private

        def stockholder_params
            params.require(:stockholder).perimit(:id, :entity_id, :cert_number, :issue_date, :shares_issued, :shares_repurchased, :shares_canceled, :shares_outstanding)
        end
end

Finally, my routes are:
resources :securities do
    resources :stockholders
end

Can anyone help me understand what's going on here?  I structured two models in exactly this way and didn't run into a problem.
Many thanks in advance

A:

Your route expects two more parameters, which are :security_id and :id.
simple_form_for @stockholder, url: { action: 'update', controller: "stockholders", security_id: @security.id, id: @stockholder.id }, ...

where @security may be @stockholder.security if not instantiated in the controller.
Or you can do it more elegantly:
simple_form_for [@security, @stockholder], ...  # url parameter is not needed

