我的Rails应用程序发给我一个路由错误:没有方法补丁或放置,但我的佣金路线说:
customer_path GET /customers/:id(.:format) customers#show
PATCH /customers/:id(.:format) customers#update
PUT /customers/:id(.:format) customers#update
DELETE /customers/:id(.:format) customers#destroy
Theres a PUT或PATCH方法!
我是铁轨的初学者,你可以帮助我:)?
如果您需要任何资源来查找此错误,请告诉我:-) Google会说1000个类似的问题,但没人帮忙:(
编辑-FORM:
<div class="panel panel-primary">
<div class="panel-heading">Allgemeine Kundeninformationen</div>
<div class="panel-body">
<table class="table-responsive form-horizontal" style="width:100%; border-collapse: separate; border-spacing: 5px;">
<tr>
<td>Kundentyp</td>
<td><%= c.select "ctype", options_for_select([['Privatkunde', 'private'], ['Vereinskunde', 'club']], @customer.ctype) , {}, {:onchange => 'onCustomerTypeSelect()', :class => 'form-control' } %>
</tr>
<tr>
<td style="width: 50%;">Kundennummer</td>
<td><%= c.text_field :id, class: 'form-control', placeholder: 'Kundennummer' %></td>
</tr>
<tr>
<td>Kundenname</td>
<td><%= c.text_field :name, class: 'form-control', placeholder: 'Kundenname' %></td>
</tr>
<% if @customer.ctype == 'private' %>
<tr id="custom1GivenName">
<td>Vorname</td>
<td><%= c.text_field :custom1, class: 'form-control', placeholder: 'Vorname' %></td>
</tr>
<% end %>
<tr>
<% if @customer.ctype == 'private' %>
<td id="privateCustomerDateOfBirth">Geburtsdatum</td>
<% else %>
<td id="clubCustomerDateOfBirth">Gründungsdatum</td>
<% end %>
<td><%= c.date_field :dateOfBirth, class: 'form-control', placeholder: 'Geburtstag' %></td>
</tr>
</table>
</div>
</div>
<div class="panel panel-primary">
<div class="panel-heading">Kontaktinformationen</div>
<div class="panel-body">
<table class="table-responsive form-horizontal" style="width:100%; border-collapse: separate; border-spacing: 5px;">
<tr>
<td style="width: 50%;">E-Mail</td>
<td><%= c.text_field :email, class: 'form-control', placeholder: 'E-Mail' %></td>
</tr>
<tr>
<td>Telefon</td>
<td><%= c.text_field :phone, class: 'form-control', placeholder: 'Telefon' %></td>
</tr>
<tr>
<td>Mobil-Telefon</td>
<td><%= c.text_field :mobilphone, class: 'form-control', placeholder: 'Mobil-Telefon' %></td>
</tr>
<tr>
<td>Webseite</td>
<td><%= c.text_field :website, class: 'form-control', placeholder: 'Website' %></td>
</tr>
</table>
</div>
</div>
<%= c.fields_for :address do |a| %>
<div class="panel panel-primary">
<div class="panel-heading">Anschrift</div>
<div class="panel-body">
<table class="table-responsive form-horizontal" style="width:100%; border-collapse: separate; border-spacing: 5px;">
<tr>
<td style="width: 50%;">Straße</td>
<td><%= a.text_field :street, class: 'form-control', placeholder: 'Straße' %></td>
</tr>
<tr>
<td>Hausnummer</td>
<td><%= a.text_field :number, class: 'form-control', placeholder: 'Hausnummer' %></td>
</tr>
<tr>
<td>Postleitzahl</td>
<td><%= a.text_field :zipcode, class: 'form-control', placeholder: 'Postleitzahl' %></td>
</tr>
<tr>
<td>Ort</td>
<td><%= a.text_field :city, class: 'form-control', placeholder: 'Ort' %></td>
</tr>
<tr>
<td>Land</td>
<td><%= a.text_field :country, class: 'form-control', placeholder: 'Land' %></td>
</tr>
</table>
</div>
</div>
<% end %>
<%= c.submit value="Kunde anpassen", class: 'btn btn-success' %>
错误-CODE: 没有路线匹配[PATCH]&#34; / customers&#34;