aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource
diff options
context:
space:
mode:
Diffstat (limited to 'activeresource')
-rw-r--r--activeresource/CHANGELOG11
-rw-r--r--activeresource/lib/active_resource/base.rb11
2 files changed, 18 insertions, 4 deletions
diff --git a/activeresource/CHANGELOG b/activeresource/CHANGELOG
index 807f887a96..07c48505d1 100644
--- a/activeresource/CHANGELOG
+++ b/activeresource/CHANGELOG
@@ -1,5 +1,16 @@
*SVN*
+* Added load_attributes_from_response as a way of loading attributes from other responses than just create [DHH]
+
+ class Highrise::Task < ActiveResource::Base
+ def complete
+ load_attributes_from_response(post(:complete))
+ end
+ end
+
+ ...will set "done_at" when complete is called.
+
+
* Added support for calling custom methods #6979 [rwdaigle]
Person.find(:managers) # => GET /people/managers.xml
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb
index be0560879d..4635a5009e 100644
--- a/activeresource/lib/active_resource/base.rb
+++ b/activeresource/lib/active_resource/base.rb
@@ -297,12 +297,15 @@ module ActiveResource
def create
returning connection.post(collection_path, to_xml) do |response|
self.id = id_from_response(response)
-
- if response['Content-size'] != "0" && response.body.strip.size > 0
- load(connection.xml_from_response(response))
- end
+ load_attributes_from_response(response)
end
end
+
+ def load_attributes_from_response(response)
+ if response['Content-size'] != "0" && response.body.strip.size > 0
+ load(connection.xml_from_response(response))
+ end
+ end
# Takes a response from a typical create post and pulls the ID out
def id_from_response(response)