Skip to content


Browse files Browse the repository at this point in the history
let's get started with PATCH method rather than PUT
  • Loading branch information
amatsuda committed Jan 3, 2013
1 parent 4b5e424 commit eed9f25
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions guides/source/
Expand Up @@ -830,7 +830,7 @@ it look as follows:
<h1>Editing post</h1>
<%= form_for :post, url: { action: :update, id: },
method: :put do |f| %>
method: :patch do |f| %>
<% if @post.errors.any? %>
<div id="errorExplanation">
<h2><%= pluralize(@post.errors.count, "error") %> prohibited
Expand Down Expand Up @@ -863,7 +863,7 @@ method: :put do |f| %>
This time we point the form to the `update` action, which is not defined yet
but will be very soon.

The `method: :put` option tells Rails that we want this form to be
The `method: :patch` option tells Rails that we want this form to be
submitted via the `PUT` HTTP method which is the HTTP method you're expected to use to
**update** resources according to the REST protocol.

Expand All @@ -873,7 +873,7 @@ Next, we need to add the `update` action. The file
`config/routes.rb` will need just one more line:

put "posts/:id" => "posts#update"
patch "posts/:id" => "posts#update"

And then create the `update` action in `app/controllers/posts_controller.rb`:
Expand Down Expand Up @@ -1051,7 +1051,7 @@ called `post_url` and `post_path` available to our application. These are
precisely the methods that the `form_for` needs when editing a post, and so now
you'll be able to update posts again.

NOTE: The `:as` option is available on the `post`, `put`, `delete` and `match`
NOTE: The `:as` option is available on the `post`, `patch`, `put`, `delete` and `match`
routing methods also.

### Deleting Posts
Expand Down Expand Up @@ -1145,7 +1145,7 @@ get "posts/new"
post "posts" => "posts#create"
get "posts/:id" => "posts#show", as: :post
get "posts/:id/edit" => "posts#edit"
put "posts/:id" => "posts#update"
patch "posts/:id" => "posts#update"
delete "posts/:id" => "posts#destroy"

Expand Down

1 comment on commit eed9f25

Copy link

@jeffnv jeffnv commented on eed9f25 Feb 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Please sign in to comment.