@@ -830,7 +830,7 @@ it look as follows:
830
830
<h1>Editing post</h1>
831
831
832
832
<%= form_for :post, url: { action: :update, id: @post.id },
833
- method: :put do |f| %>
833
+ method: :patch do |f| %>
834
834
<% if @post.errors.any? %>
835
835
<div id="errorExplanation">
836
836
<h2><%= pluralize(@post.errors.count, "error") %> prohibited
@@ -863,7 +863,7 @@ method: :put do |f| %>
863
863
This time we point the form to the ` update ` action, which is not defined yet
864
864
but will be very soon.
865
865
866
- The ` method: :put ` option tells Rails that we want this form to be
866
+ The ` method: :patch ` option tells Rails that we want this form to be
867
867
submitted via the ` PUT ` HTTP method which is the HTTP method you're expected to use to
868
868
** update** resources according to the REST protocol.
869
869
@@ -873,7 +873,7 @@ Next, we need to add the `update` action. The file
873
873
` config/routes.rb ` will need just one more line:
874
874
875
875
``` ruby
876
- put " posts/:id" => " posts#update"
876
+ patch " posts/:id" => " posts#update"
877
877
```
878
878
879
879
And then create the ` update ` action in ` app/controllers/posts_controller.rb ` :
@@ -1051,7 +1051,7 @@ called `post_url` and `post_path` available to our application. These are
1051
1051
precisely the methods that the ` form_for ` needs when editing a post, and so now
1052
1052
you'll be able to update posts again.
1053
1053
1054
- NOTE: The ` :as ` option is available on the ` post ` , ` put ` , ` delete ` and ` match `
1054
+ NOTE: The ` :as ` option is available on the ` post ` , ` patch ` , ` put ` , ` delete ` and ` match `
1055
1055
routing methods also.
1056
1056
1057
1057
### Deleting Posts
@@ -1145,7 +1145,7 @@ get "posts/new"
1145
1145
post " posts" => " posts#create"
1146
1146
get " posts/:id" => " posts#show" , as: :post
1147
1147
get " posts/:id/edit" => " posts#edit"
1148
- put " posts/:id" => " posts#update"
1148
+ patch " posts/:id" => " posts#update"
1149
1149
delete " posts/:id" => " posts#destroy"
1150
1150
```
1151
1151
0 commit comments