diff options
Diffstat (limited to 'activeresource/lib/active_resource/custom_methods.rb')
-rw-r--r-- | activeresource/lib/active_resource/custom_methods.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/activeresource/lib/active_resource/custom_methods.rb b/activeresource/lib/active_resource/custom_methods.rb index a0eb28ed13..095dcd2a8e 100644 --- a/activeresource/lib/active_resource/custom_methods.rb +++ b/activeresource/lib/active_resource/custom_methods.rb @@ -11,10 +11,10 @@ module ActiveResource # # This route set creates routes for the following HTTP requests: # - # POST /people/new/register.json # PeopleController.register - # 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 + # POST /people/new/register.json # PeopleController.register + # PUT/PATCH /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 # # Using this module, Active Resource can use these custom REST methods just like the # standard methods. @@ -63,6 +63,10 @@ module ActiveResource connection.post(custom_method_collection_url(custom_method_name, options), body, headers) end + def patch(custom_method_name, options = {}, body = '') + connection.patch(custom_method_collection_url(custom_method_name, options), body, headers) + end + def put(custom_method_name, options = {}, body = '') connection.put(custom_method_collection_url(custom_method_name, options), body, headers) end @@ -98,6 +102,10 @@ module ActiveResource end end + def patch(method_name, options = {}, body = '') + connection.patch(custom_method_element_url(method_name, options), body, self.class.headers) + end + def put(method_name, options = {}, body = '') connection.put(custom_method_element_url(method_name, options), body, self.class.headers) end |