From b7a094536de6fdeb428aa79d21f1e2128169f45e Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Fri, 24 Feb 2012 16:25:41 -0800 Subject: uses PATCH for the forms of persisted records, and routes PATCH and PUT to the update action of resources --- actionpack/lib/action_dispatch/routing/mapper.rb | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'actionpack/lib/action_dispatch/routing/mapper.rb') diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index f66d28bf83..ecad8b258b 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -7,8 +7,6 @@ require 'action_dispatch/routing/redirection' module ActionDispatch module Routing class Mapper - cattr_accessor(:default_method_for_update) {:put} - class Constraints #:nodoc: def self.new(app, constraints, request = Rack::Request) if constraints.any? @@ -1012,10 +1010,11 @@ module ActionDispatch end if parent_resource.actions.include?(:new) member do - get :edit if parent_resource.actions.include?(:edit) - get :show if parent_resource.actions.include?(:show) + get :edit if parent_resource.actions.include?(:edit) + get :show if parent_resource.actions.include?(:show) if parent_resource.actions.include?(:update) - send default_method_for_update, :update + patch :update + put :update end delete :destroy if parent_resource.actions.include?(:destroy) end @@ -1152,12 +1151,12 @@ module ActionDispatch get :new end if parent_resource.actions.include?(:new) - # TODO: Only accept patch or put depending on config member do - get :edit if parent_resource.actions.include?(:edit) - get :show if parent_resource.actions.include?(:show) + get :edit if parent_resource.actions.include?(:edit) + get :show if parent_resource.actions.include?(:show) if parent_resource.actions.include?(:update) - send default_method_for_update, :update + patch :update + put :update end delete :destroy if parent_resource.actions.include?(:destroy) end -- cgit v1.2.3