Hidden PATCH Request in Rails
Published on 31 Mar 2020
View
<%= form_for(@subject) do |f| %>
<table summary="Subject fmrm fields">
<tr>
<th>Name</th>
<td><%= f.text_field(:name) %></td>
</tr>
<tr>
<th>Position</th>
<td><%= f.text_field(:position) %></td>
</tr>
<tr>
<th>Visible</th>
<td><%= f.text_field(:visible) %></td>
</tr>
</table>
<div class="form-buttons">
<%= f.submit("Update Subject") %>
</div>
<% end %>
Rendered HTML
<form class="edit_subject" id="edit_subject_76" action="/subjects/76" accept-charset="UTF-8" method="post">
<input type="hidden" name="_method" value="patch">
<input type="hidden" name="authenticity_token" value="oCDkPYIyZRnpIVKN4B0Te9Wj0p6ck60iz3bz3bEPUGnAGjPcq1bm8Pc+IQD+SjxEhsQUVWvHTuNXFtN1l4zOag==">
...
</form>
POST Input
<form class="edit_subject" id="edit_subject_76" action="/subjects/76" accept-charset="UTF-8" method="post">
PATCH Hidden Input
<input type="hidden" name="_method" value="patch">
all tags
activerecord android annoyances api apt arch array artix atom az3w backend bash blog browser bug callback career cli cloud code coding config configuration cp crud css database db design devops django email erp filter fugitive gif gist git gnome grep hebrew http ide isbn-fetcher iso javascript job search js kanban kanban\ kindle koans linux logger manjaro map markdown microservices mobi mtp neovim nodejs packages pastbin patch post python rails reduce refactoring rest routes rspec ruby scripting security sed shell sql string_replacement study tdd terminal testing version_control vim walkthrough workflow