Validating save returns boolean; update and create return responses.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5810 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper 2006-12-29 22:28:30 +00:00
parent 73101af6ab
commit 54e56ddb60
2 changed files with 6 additions and 6 deletions

View File

@ -205,13 +205,12 @@ module ActiveResource
def update
connection.put(element_path, to_xml)
true
end
def create
resp = connection.post(collection_path, to_xml)
self.id = id_from_response(resp)
true
returning connection.post(collection_path, to_xml) do |response|
self.id = id_from_response(response)
end
end
# takes a response from a typical create post and pulls the ID out

View File

@ -109,9 +109,10 @@ module ActiveResource
def save_with_validation
save_without_validation
true
rescue ResourceInvalid => error
errors.from_xml(error.response.body)
return false
false
end
def valid?