diff options
Diffstat (limited to 'actionpack/lib/action_controller/integration.rb')
-rw-r--r-- | actionpack/lib/action_controller/integration.rb | 17 |
1 files changed, 10 insertions, 7 deletions
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 |