From 59bd6586c8e7e290187978f3868d435ee267006c Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Sun, 30 Apr 2006 20:17:06 +0000 Subject: Add Integration Session methods for PUT and DELETE requests [Rick] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4317 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/integration.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'actionpack/lib/action_controller/integration.rb') diff --git a/actionpack/lib/action_controller/integration.rb b/actionpack/lib/action_controller/integration.rb index 56ac4b74fe..afceffce89 100644 --- a/actionpack/lib/action_controller/integration.rb +++ b/actionpack/lib/action_controller/integration.rb @@ -143,17 +143,20 @@ module ActionController # (application/x-www-form-urlencoded or multipart/form-data). The headers # should be a hash. The keys will automatically be upcased, with the # prefix 'HTTP_' added if needed. + # + # You can also perform POST, PUT, DELETE, and HEAD requests with #post, + # #put, #delete, and #head. def get(path, parameters=nil, headers=nil) process :get, path, parameters, headers end - # Performs a POST request with the given parameters. The parameters may - # be +nil+, a Hash, or a string that is appropriately encoded - # (application/x-www-form-urlencoded or multipart/form-data). The headers - # should be a hash. The keys will automatically be upcased, with the - # prefix 'HTTP_' added if needed. - def post(path, parameters=nil, headers=nil) - process :post, path, parameters, headers + # keep the docs for #get + %w( post put delete head ).each do |method| + class_eval <<-EOV, __FILE__, __LINE__ + def #{method}(path, parameters=nil, headers=nil) + process :#{method}, path, parameters, headers + end + EOV end # Performs an XMLHttpRequest request with the given parameters, mimicing -- cgit v1.2.3