From 353497458b460d03114905e001f782c6f0b463fa Mon Sep 17 00:00:00 2001 From: Leon Breedt Date: Sat, 2 Apr 2005 22:05:16 +0000 Subject: filter out embedded nil values for XML-RPC git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1073 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/action_web_service/protocol/xmlrpc_protocol.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'actionwebservice/lib/action_web_service/protocol') diff --git a/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb b/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb index de6c8c8a30..ed7ba5c512 100644 --- a/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb +++ b/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb @@ -51,11 +51,18 @@ module ActionWebService # :nodoc: if value.is_a?(ActionWebService::Struct) struct = {} value.class.members.each do |name, type| - struct[name.to_s] = value_to_xmlrpc_wire_format(value[name], type) + member_value = value[name] + next if member_value.nil? + struct[name.to_s] = value_to_xmlrpc_wire_format(member_value, type) end struct elsif value.is_a?(ActiveRecord::Base) - value.attributes.dup + struct = {} + value.attributes.each do |key, member_value| + next if member_value.nil? + struct[key.to_s] = member_value + end + struct elsif value.is_a?(Exception) && !value.is_a?(XMLRPC::FaultException) XMLRPC::FaultException.new(2, value.message) else -- cgit v1.2.3