aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2013-06-03 05:20:13 -0700
committerDavid Heinemeier Hansson <david@loudthinking.com>2013-06-03 05:20:13 -0700
commit051228699d05b2781b298cfde02714a8f7a8bf46 (patch)
tree960233afaa6c7e2f4ac60950275ea336fd8cf571 /guides
parent17a113289dccf276bf316b99fa13dbfa9ff759d2 (diff)
parent03dbd8af56c8c45f8b39aa6e081656bd13c06c4a (diff)
downloadrails-051228699d05b2781b298cfde02714a8f7a8bf46.tar.gz
rails-051228699d05b2781b298cfde02714a8f7a8bf46.tar.bz2
rails-051228699d05b2781b298cfde02714a8f7a8bf46.zip
Merge pull request #10747 from javan/patch-1
Add note about upgrading custom routes from `put` to `patch`.
Diffstat (limited to 'guides')
-rw-r--r--guides/source/upgrading_ruby_on_rails.md18
1 files changed, 18 insertions, 0 deletions
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md
index 6c3e763f53..84526b595b 100644
--- a/guides/source/upgrading_ruby_on_rails.md
+++ b/guides/source/upgrading_ruby_on_rails.md
@@ -41,6 +41,24 @@ So, in Rails 4 both `PUT` and `PATCH` are routed to update. We recommend
switching to `PATCH` as part of your upgrade process if possible, as it's more
likely what you want.
+Note, when using `form_for` to update a resource in conjunction with a custom route,
+you'll need to update your route to explicity match the `patch` verb:
+
+```erb
+<%= form_for [ :update_name, @user ] do |f| %>
+ ...
+<% end %>
+```
+
+```ruby
+resources :users do
+ # Rails 3
+ put :update_name, on: :member
+ # Rails 4
+ patch :update_name, on: :member
+end
+```
+
For more on PATCH and why this change was made, see [this post](http://weblog.rubyonrails.org/2012/2/25/edge-rails-patch-is-the-new-primary-http-method-for-updates/)
on the Rails blog.