From_xml rails 2.0 no worky!

I’m trying to use my_model.from_xml() to rehydrate an ActiveRecord
object with associations. When I do this I was getting either

ActiveRecord::AssociationTypeMismatch: HouseOfQuality expected, got
ActiveRecord::AssociationTypeMismatch: HouseOfQuality expected, got

Depending on if the association I had had the type=“array” on the
association element in the xml.

I even tried this:

bob = Bob.find(1)
another_bob =

Here is the what the rails 2.0 release says which I think means I
should be able to do this…what am I doing wrong?

Active Record: XML in, JSON out

Active Record has supported serialization to XML for a while. In 2.0
we’ve added deserialization too, so you can say“David”) and get what you’d expect. We’ve also
added serialization to JSON, which supports the same syntax as XML
serialization (including nested associations). Just do person.to_json
and you’re ready to roll.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs