aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/lib/active_resource/base.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-12-05 19:12:51 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-12-05 19:12:51 +0000
commit7370e54cc4d6b298a29383bf943b277bcfb730aa (patch)
tree5585190cfb324c1dbfcdebf69e431cc901e45960 /activeresource/lib/active_resource/base.rb
parent0ee0c1b2aae3cb90869c79235470e6b69296feeb (diff)
downloadrails-7370e54cc4d6b298a29383bf943b277bcfb730aa.tar.gz
rails-7370e54cc4d6b298a29383bf943b277bcfb730aa.tar.bz2
rails-7370e54cc4d6b298a29383bf943b277bcfb730aa.zip
*_path instance methods. Check for missing/invalid site uri. http_mock response takes message arg, extracts numeric code. Tests log to test/debug.log
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5680 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
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)