From 628838ed9349252eccd86b531959c111e285893e Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Mon, 2 Oct 2006 22:14:15 +0000 Subject: Make #save behavior mimic AR::Base#save (true on success, false on failure) git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5220 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activeresource/lib/active_resource/base.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'activeresource/lib/active_resource/base.rb') diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb index cb520eef5c..656698fb25 100644 --- a/activeresource/lib/active_resource/base.rb +++ b/activeresource/lib/active_resource/base.rb @@ -169,12 +169,13 @@ module ActiveResource def update connection.put(self.class.element_path(id, prefix_options), to_xml) + true end def create - returning connection.post(self.class.collection_path(prefix_options), to_xml) do |resp| - self.id = id_from_response(resp) - end + resp = connection.post(self.class.collection_path(prefix_options), to_xml) + self.id = id_from_response(resp) + true end # takes a response from a typical create post and pulls the ID out -- cgit v1.2.3