aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/lib/active_resource/base.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activeresource/lib/active_resource/base.rb')
-rw-r--r--activeresource/lib/active_resource/base.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb
index 5d72d98be6..07933d499b 100644
--- a/activeresource/lib/active_resource/base.rb
+++ b/activeresource/lib/active_resource/base.rb
@@ -106,7 +106,7 @@ module ActiveResource
end
def destroy
- connection.delete(self.class.element_path(id, prefix_options))
+ connection.delete(element_path)
end
def to_xml(options={})
@@ -155,12 +155,12 @@ module ActiveResource
end
def update
- connection.put(self.class.element_path(id, prefix_options), to_xml)
+ connection.put(element_path, to_xml)
true
end
def create
- resp = connection.post(self.class.collection_path(prefix_options), to_xml)
+ resp = connection.post(collection_path, to_xml)
self.id = id_from_response(resp)
true
end
@@ -170,6 +170,14 @@ module ActiveResource
response['Location'][/\/([^\/]*?)(\.\w+)?$/, 1]
end
+ def element_path(options = nil)
+ self.class.element_path(id, options || prefix_options)
+ end
+
+ def collection_path(options = nil)
+ self.class.collection_path(options || prefix_options)
+ end
+
private
def find_or_create_resource_for_collection(name)
find_or_create_resource_for(name.to_s.singularize)