From 002713c64568114f3754799acc0723ea0d442f7a Mon Sep 17 00:00:00 2001 From: David Lee Date: Fri, 6 May 2011 14:03:55 -0700 Subject: Add config.default_method_for_update to support PATCH PATCH is the correct HTML verb to map to the #update action. The semantics for PATCH allows for partial updates, whereas PUT requires a complete replacement. Changes: * adds config.default_method_for_update you can set to :patch * optionally use PATCH instead of PUT in resource routes and forms * adds the #patch verb to routes to detect PATCH requests * adds #patch? to Request * changes documentation and comments to indicate support for PATCH This change maintains complete backwards compatibility by keeping :put as the default for config.default_method_for_update. --- railties/lib/rails/generators/active_model.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'railties/lib/rails/generators/active_model.rb') diff --git a/railties/lib/rails/generators/active_model.rb b/railties/lib/rails/generators/active_model.rb index 4b828340d2..f51028b657 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 update + # PUT/PATCH update # DELETE destroy def self.find(klass, params=nil) "#{klass}.find(#{params})" @@ -58,13 +58,13 @@ module Rails "#{name}.save" end - # PUT update + # PUT/PATCH update def update_attributes(params=nil) "#{name}.update_attributes(#{params})" end # POST create - # PUT update + # PUT/PATCH update def errors "#{name}.errors" end -- cgit v1.2.3