lib/active_resource/validations.rb in activeresource-2.3.5 vs lib/active_resource/validations.rb in activeresource-2.3.6
- old
+ new
@@ -257,13 +257,13 @@
# Validate a resource and save (POST) it to the remote web service.
def save_with_validation
save_without_validation
true
rescue ResourceInvalid => error
- case error.response['Content-Type']
- when /xml/
+ case self.class.format
+ when ActiveResource::Formats[:xml]
errors.from_xml(error.response.body)
- when /json/
+ when ActiveResource::Formats[:json]
errors.from_json(error.response.body)
end
false
end