Permalink
Browse files

filter out embedded nil values for XML-RPC

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1073 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent aaea48f commit 353497458b460d03114905e001f782c6f0b463fa @leonbreedt leonbreedt committed Apr 2, 2005
Showing with 9 additions and 2 deletions.
  1. +9 −2 actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb
@@ -51,11 +51,18 @@ def value_to_xmlrpc_wire_format(value, value_type)
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

0 comments on commit 3534974

Please sign in to comment.