# Soap4r en keyvaluepair

**URL:** <https://www.ruby-forum.com/t/soap4r-en-keyvaluepair/142683>\
**Category:** Rails\
**Created:** [July 10, 2008, 11:11am UTC](https://www.ruby-forum.com/t/soap4r-en-keyvaluepair/142683 "2008-07-10T11:11:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel304](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e5b9ba/32.png) [@daniel304](https://www.ruby-forum.com/u/daniel304)\
**Post date:** [July 10, 2008, 11:11am UTC](https://www.ruby-forum.com/t/soap4r-en-keyvaluepair/142683/1 "2008-07-10T11:11:48Z")

</div>

I’m making a soap connection to an external program that will give me  
informatieoon in keyvalue pairs like this manner

email removed\_email\_address@domain.invalid optin1 true

I want to map it on my object that has the same keys I’m doing it like  
this  
@contactInfo.keyValuePairs.each do |kvp|  
@knowington.update\_attribute(kvp.key,kvp.value)  
end

The big drawback is that it will update the object for every key is  
there a better way to deal with this ???

---

<div class="post-metadata">

**Author:** ![daniel304](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e5b9ba/32.png) [@daniel304](https://www.ruby-forum.com/u/daniel304)\
**Post date:** [July 10, 2008, 11:49am UTC](https://www.ruby-forum.com/t/soap4r-en-keyvaluepair/142683/2 "2008-07-10T11:49:14Z")

</div>

On 10 Jul 2008, at 10:11, Daniel Van den oord wrote:

> true
> 
> I want to map it on my object that has the same keys I’m doing it like  
> this  
> @contactInfo.keyValuePairs.each do |kvp|  
> @knowington.update\_attribute(kvp.key,kvp.value)  
> end
> 
> The big drawback is that it will update the object for every key is  
> there a better way to deal with this ???  
> Off the top of my head,  
> build up a hash and use update\_attributes or do @knowington[kvp.key] =  
> kvp.key and then save at the end or call the accessor methods and then  
> save

Fred
