0





59

Advertisement

I am trying to deserialize an object from XML in Ruby.

Something simple like:

u = User.new({:client_key => "Bar"})
v = User.new(u.to_xml)

I get an error:

NoMethodError: undefined method 'stringify_keys!' for #String:0x20fc7cc>

I'm not sure what I have to do in order to get the string from XML to an object.

Update: @avdi gave me the tip. I was expecting from_xml to be a self method. You have to create the object first.

v = User.new
v.from_xml(s)
Question author Matt-brown | Source

Advertisement


0