On 10 Jul 2008, at 10:11, Daniel Van den oord wrote:
>
> I''m making a soap connection to an external program that will give
me
> informatieoon in keyvalue pairs like this manner
>
> <keyValuePairs>
> <key>email</key>
> <value>daniel-24wWhQsETqk@public.gmane.org</value>
> </keyValuePairs>
> <keyValuePairs>
> <key>optin1</key>
> <value>true</value>
> </keyValuePairs>
>
> 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>
> --
> Posted via http://www.ruby-forum.com/.
>
> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google
> Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
> -~----------~----~----~----~------~----~------~--~---
>