aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2012-02-24 16:35:48 -0800
committerXavier Noria <fxn@hashref.com>2012-02-24 16:35:48 -0800
commit3008188cd6c0cca8789e8b7c57a4f896e2ff07d5 (patch)
tree7cb1eb98c228cebaa343a417208f6ab8bf3c7a40
parentb7a094536de6fdeb428aa79d21f1e2128169f45e (diff)
downloadrails-3008188cd6c0cca8789e8b7c57a4f896e2ff07d5.tar.gz
rails-3008188cd6c0cca8789e8b7c57a4f896e2ff07d5.tar.bz2
rails-3008188cd6c0cca8789e8b7c57a4f896e2ff07d5.zip
consistently mention first patch, then put
There was a mix, sometimes patch first, sometimes put first. Use always patch first, since this is going to be the primary verb for updates.
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb14
-rw-r--r--actionpack/lib/action_dispatch/testing/integration.rb2
-rw-r--r--actionpack/lib/action_view/helpers/url_helper.rb2
-rw-r--r--activeresource/lib/active_resource/custom_methods.rb2
-rw-r--r--activeresource/lib/active_resource/http_mock.rb6
-rw-r--r--railties/guides/source/ajax_on_rails.textile4
-rw-r--r--railties/guides/source/configuring.textile2
-rw-r--r--railties/guides/source/routing.textile16
-rw-r--r--railties/lib/rails/generators/active_model.rb6
-rw-r--r--railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb4
10 files changed, 29 insertions, 29 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index ecad8b258b..4f55537fe2 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -537,7 +537,7 @@ module ActionDispatch
# POST /admin/posts
# GET /admin/posts/1
# GET /admin/posts/1/edit
- # PUT/PATCH /admin/posts/1
+ # PATCH/PUT /admin/posts/1
# DELETE /admin/posts/1
#
# If you want to route /posts (without the prefix /admin) to
@@ -571,7 +571,7 @@ module ActionDispatch
# POST /admin/posts
# GET /admin/posts/1
# GET /admin/posts/1/edit
- # PUT/PATCH /admin/posts/1
+ # PATCH/PUT /admin/posts/1
# DELETE /admin/posts/1
module Scoping
# Scopes a set of routes to the given default options.
@@ -666,7 +666,7 @@ module ActionDispatch
# new_admin_post GET /admin/posts/new(.:format) admin/posts#new
# edit_admin_post GET /admin/posts/:id/edit(.:format) admin/posts#edit
# admin_post GET /admin/posts/:id(.:format) admin/posts#show
- # admin_post PUT/PATCH /admin/posts/:id(.:format) admin/posts#update
+ # admin_post PATCH/PUT /admin/posts/:id(.:format) admin/posts#update
# admin_post DELETE /admin/posts/:id(.:format) admin/posts#destroy
#
# === Options
@@ -986,7 +986,7 @@ module ActionDispatch
# POST /geocoder
# GET /geocoder
# GET /geocoder/edit
- # PUT/PATCH /geocoder
+ # PATCH/PUT /geocoder
# DELETE /geocoder
#
# === Options
@@ -1038,7 +1038,7 @@ module ActionDispatch
# POST /photos
# GET /photos/:id
# GET /photos/:id/edit
- # PUT/PATCH /photos/:id
+ # PATCH/PUT /photos/:id
# DELETE /photos/:id
#
# Resources can also be nested infinitely by using this block syntax:
@@ -1054,7 +1054,7 @@ module ActionDispatch
# POST /photos/:photo_id/comments
# GET /photos/:photo_id/comments/:id
# GET /photos/:photo_id/comments/:id/edit
- # PUT/PATCH /photos/:photo_id/comments/:id
+ # PATCH/PUT /photos/:photo_id/comments/:id
# DELETE /photos/:photo_id/comments/:id
#
# === Options
@@ -1122,7 +1122,7 @@ module ActionDispatch
# new_post_comment GET /posts/:post_id/comments/new(.:format)
# edit_comment GET /sekret/comments/:id/edit(.:format)
# comment GET /sekret/comments/:id(.:format)
- # comment PUT/PATCH /sekret/comments/:id(.:format)
+ # comment PATCH/PUT /sekret/comments/:id(.:format)
# comment DELETE /sekret/comments/:id(.:format)
#
# === Examples
diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb
index 62b3a344f8..69d54f6981 100644
--- a/actionpack/lib/action_dispatch/testing/integration.rb
+++ b/actionpack/lib/action_dispatch/testing/integration.rb
@@ -330,7 +330,7 @@ module ActionDispatch
@integration_session = Integration::Session.new(app)
end
- %w(get post put patch head delete options cookies assigns
+ %w(get post patch put head delete options cookies assigns
xml_http_request xhr get_via_redirect post_via_redirect).each do |method|
define_method(method) do |*args|
reset! unless integration_session
diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb
index 93f476926c..8d7417809b 100644
--- a/actionpack/lib/action_view/helpers/url_helper.rb
+++ b/actionpack/lib/action_view/helpers/url_helper.rb
@@ -329,7 +329,7 @@ module ActionView
remote = html_options.delete('remote')
method = html_options.delete('method').to_s
- method_tag = %w{put patch delete}.include?(method) ? method_tag(method) : ""
+ method_tag = %w{patch put delete}.include?(method) ? method_tag(method) : ""
form_method = method == 'get' ? 'get' : 'post'
form_options = html_options.delete('form') || {}
diff --git a/activeresource/lib/active_resource/custom_methods.rb b/activeresource/lib/active_resource/custom_methods.rb
index 095dcd2a8e..839dc79d50 100644
--- a/activeresource/lib/active_resource/custom_methods.rb
+++ b/activeresource/lib/active_resource/custom_methods.rb
@@ -12,7 +12,7 @@ module ActiveResource
# This route set creates routes for the following HTTP requests:
#
# POST /people/new/register.json # PeopleController.register
- # PUT/PATCH /people/1/promote.json # PeopleController.promote with :id => 1
+ # PATCH/PUT /people/1/promote.json # PeopleController.promote with :id => 1
# DELETE /people/1/deactivate.json # PeopleController.deactivate with :id => 1
# GET /people/active.json # PeopleController.active
#
diff --git a/activeresource/lib/active_resource/http_mock.rb b/activeresource/lib/active_resource/http_mock.rb
index 820b178d4b..9856f5872f 100644
--- a/activeresource/lib/active_resource/http_mock.rb
+++ b/activeresource/lib/active_resource/http_mock.rb
@@ -55,7 +55,7 @@ module ActiveResource
@responses = responses
end
- [ :post, :put, :patch, :get, :delete, :head ].each do |method|
+ [ :post, :patch, :put, :get, :delete, :head ].each do |method|
# def post(path, request_headers = {}, body = nil, status = 200, response_headers = {})
# @responses[Request.new(:post, path, nil, request_headers)] = Response.new(body || "", status, response_headers)
# end
@@ -291,9 +291,9 @@ module ActiveResource
if resp_cls && !resp_cls.body_permitted?
@body = nil
end
-
+
self['Content-Length'] = @body.nil? ? "0" : body.size.to_s
-
+
end
# Returns true if code is 2xx,
diff --git a/railties/guides/source/ajax_on_rails.textile b/railties/guides/source/ajax_on_rails.textile
index 5dbfc41e9f..5913a472fd 100644
--- a/railties/guides/source/ajax_on_rails.textile
+++ b/railties/guides/source/ajax_on_rails.textile
@@ -147,7 +147,7 @@ link_to_remote "Add new item",
</ruby>
** *:method* Most typically you want to use a POST request when adding a remote
-link to your view so this is the default behavior. However, sometimes you'll want to update (PUT/PATCH) or delete/destroy (DELETE) something and you can specify this with the +:method+ option. Let's see an example for a typical AJAX link for deleting an item from a list:
+link to your view so this is the default behavior. However, sometimes you'll want to update (PATCH/PUT) or delete/destroy (DELETE) something and you can specify this with the +:method+ option. Let's see an example for a typical AJAX link for deleting an item from a list:
<ruby>
link_to_remote "Delete the item",
@@ -168,7 +168,7 @@ Note that if we wouldn't override the default behavior (POST), the above snippet
<ruby>
link_to_remote "Update record",
:url => record_url(record),
- :method => :put,
+ :method => :patch,
:with => "'status=' <plus> 'encodeURIComponent($('status').value) <plus> '&completed=' <plus> $('completed')"
</ruby>
diff --git a/railties/guides/source/configuring.textile b/railties/guides/source/configuring.textile
index 068caf3505..316a7e2bb6 100644
--- a/railties/guides/source/configuring.textile
+++ b/railties/guides/source/configuring.textile
@@ -214,7 +214,7 @@ Every Rails application comes with a standard set of middleware which it uses in
* +ActionDispatch::Session::CookieStore+ is responsible for storing the session in cookies. An alternate middleware can be used for this by changing the +config.action_controller.session_store+ to an alternate value. Additionally, options passed to this can be configured by using +config.action_controller.session_options+.
* +ActionDispatch::Flash+ sets up the +flash+ keys. Only available if +config.action_controller.session_store+ is set to a value.
* +ActionDispatch::ParamsParser+ parses out parameters from the request into +params+.
-* +Rack::MethodOverride+ allows the method to be overridden if +params[:_method]+ is set. This is the middleware which supports the PUT, PATCH, and DELETE HTTP method types.
+* +Rack::MethodOverride+ allows the method to be overridden if +params[:_method]+ is set. This is the middleware which supports the PATCH, PUT, and DELETE HTTP method types.
* +ActionDispatch::Head+ converts HEAD requests to GET requests and serves them as so.
* +ActionDispatch::BestStandardsSupport+ enables "best standards support" so that IE8 renders some elements correctly.
diff --git a/railties/guides/source/routing.textile b/railties/guides/source/routing.textile
index 9a31d54e0f..df2bd9d0c9 100644
--- a/railties/guides/source/routing.textile
+++ b/railties/guides/source/routing.textile
@@ -82,7 +82,7 @@ creates seven different routes in your application, all mapping to the +Photos+
|POST |/photos |create |create a new photo |
|GET |/photos/:id |show |display a specific photo |
|GET |/photos/:id/edit |edit |return an HTML form for editing a photo |
-|PUT/PATCH |/photos/:id |update |update a specific photo |
+|PATCH/PUT |/photos/:id |update |update a specific photo |
|DELETE |/photos/:id |destroy |delete a specific photo |
NOTE: Rails routes are matched in the order they are specified, so if you have a +resources :photos+ above a +get 'photos/poll'+ the +show+ action's route for the +resources+ line will be matched before the +get+ line. To fix this, move the +get+ line *above* the +resources+ line so that it is matched first.
@@ -137,7 +137,7 @@ creates six different routes in your application, all mapping to the +Geocoders+
|POST |/geocoder |create |create the new geocoder |
|GET |/geocoder |show |display the one and only geocoder resource |
|GET |/geocoder/edit |edit |return an HTML form for editing the geocoder |
-|PUT/PATCH |/geocoder |update |update the one and only geocoder resource |
+|PATCH/PUT |/geocoder |update |update the one and only geocoder resource |
|DELETE |/geocoder |destroy |delete the geocoder resource |
NOTE: Because you might want to use the same controller for a singular route (+/account+) and a plural route (+/accounts/45+), singular resources map to plural controllers.
@@ -168,7 +168,7 @@ This will create a number of routes for each of the +posts+ and +comments+ contr
|POST |/admin/posts |create | admin_posts_path |
|GET |/admin/posts/:id |show | admin_post_path(:id) |
|GET |/admin/posts/:id/edit |edit | edit_admin_post_path(:id) |
-|PUT/PATCH |/admin/posts/:id |update | admin_post_path(:id) |
+|PATCH/PUT |/admin/posts/:id |update | admin_post_path(:id) |
|DELETE |/admin/posts/:id |destroy | admin_post_path(:id) |
If you want to route +/posts+ (without the prefix +/admin+) to +Admin::PostsController+, you could use
@@ -207,7 +207,7 @@ In each of these cases, the named routes remain the same as if you did not use +
|POST |/admin/posts |create | posts_path |
|GET |/admin/posts/:id |show | post_path(:id) |
|GET |/admin/posts/:id/edit|edit | edit_post_path(:id)|
-|PUT/PATCH |/admin/posts/:id |update | post_path(:id) |
+|PATCH/PUT |/admin/posts/:id |update | post_path(:id) |
|DELETE |/admin/posts/:id |destroy | post_path(:id) |
h4. Nested Resources
@@ -240,7 +240,7 @@ In addition to the routes for magazines, this declaration will also route ads to
|POST |/magazines/:id/ads |create |create a new ad belonging to a specific magazine |
|GET |/magazines/:id/ads/:id |show |display a specific ad belonging to a specific magazine |
|GET |/magazines/:id/ads/:id/edit |edit |return an HTML form for editing an ad belonging to a specific magazine |
-|PUT/PATCH |/magazines/:id/ads/:id |update |update a specific ad belonging to a specific magazine |
+|PATCH/PUT |/magazines/:id/ads/:id |update |update a specific ad belonging to a specific magazine |
|DELETE |/magazines/:id/ads/:id |destroy |delete a specific ad belonging to a specific magazine |
This will also create routing helpers such as +magazine_ads_url+ and +edit_magazine_ad_path+. These helpers take an instance of Magazine as the first parameter (+magazine_ads_url(@magazine)+).
@@ -640,7 +640,7 @@ will recognize incoming paths beginning with +/photos+ but route to the +Images+
|POST |/photos |create | photos_path |
|GET |/photos/:id |show | photo_path(:id) |
|GET |/photos/:id/edit |edit | edit_photo_path(:id) |
-|PUT/PATCH |/photos/:id |update | photo_path(:id) |
+|PATCH/PUT |/photos/:id |update | photo_path(:id) |
|DELETE |/photos/:id |destroy | photo_path(:id) |
NOTE: Use +photos_path+, +new_photo_path+, etc. to generate paths for this resource.
@@ -684,7 +684,7 @@ will recognize incoming paths beginning with +/photos+ and route the requests to
|POST |/photos |create | images_path |
|GET |/photos/:id |show | image_path(:id) |
|GET |/photos/:id/edit |edit | edit_image_path(:id) |
-|PUT/PATCH |/photos/:id |update | image_path(:id) |
+|PATCH/PUT |/photos/:id |update | image_path(:id) |
|DELETE |/photos/:id |destroy | image_path(:id) |
h4. Overriding the +new+ and +edit+ Segments
@@ -788,7 +788,7 @@ Rails now creates routes to the +CategoriesController+.
|POST |/kategorien |create | categories_path |
|GET |/kategorien/:id |show | category_path(:id) |
|GET |/kategorien/:id/bearbeiten |edit | edit_category_path(:id) |
-|PUT/PATCH |/kategorien/:id |update | category_path(:id) |
+|PATCH/PUT |/kategorien/:id |update | category_path(:id) |
|DELETE |/kategorien/:id |destroy | category_path(:id) |
h4. Overriding the Singular Form
diff --git a/railties/lib/rails/generators/active_model.rb b/railties/lib/rails/generators/active_model.rb
index f51028b657..454327f765 100644
--- a/railties/lib/rails/generators/active_model.rb
+++ b/railties/lib/rails/generators/active_model.rb
@@ -37,7 +37,7 @@ module Rails
# GET show
# GET edit
- # PUT/PATCH update
+ # PATCH/PUT update
# DELETE destroy
def self.find(klass, params=nil)
"#{klass}.find(#{params})"
@@ -58,13 +58,13 @@ module Rails
"#{name}.save"
end
- # PUT/PATCH update
+ # PATCH/PUT update
def update_attributes(params=nil)
"#{name}.update_attributes(#{params})"
end
# POST create
- # PUT/PATCH update
+ # PATCH/PUT update
def errors
"#{name}.errors"
end
diff --git a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb b/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
index 566d78c6eb..ee49534a04 100644
--- a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
+++ b/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
@@ -54,8 +54,8 @@ class <%= controller_class_name %>Controller < ApplicationController
end
end
- # PUT/PATCH <%= route_url %>/1
- # PUT/PATCH <%= route_url %>/1.json
+ # PATCH/PUT <%= route_url %>/1
+ # PATCH/PUT <%= route_url %>/1.json
def update
@<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>