rails inverting to_xml and getting the original model
- by djacobs7
I did this:
[User.first, User.last].to_xml
and got this:
<users type="array">
<user>
<created-at type="datetime">2010-03-16T06:40:51Z</created-at>
<id type="integer">3</id>
<password-hash></password-hash>
<salt></salt>
<updated-at type="datetime">2010-03-16T06:40:51Z</updated-at>
<username nil="true"></username>
</user>
<user>
<created-at type="datetime">2010-03-23T03:58:15Z</created-at>
<id type="integer">7</id>
<password-hash></password-hash>
<salt></salt>
<tutorial-state nil="true"></tutorial-state>
<updated-at type="datetime">2010-03-23T03:58:15Z</updated-at>
<username nil="true"></username>
</user>
</users>
How can I take that string of xml and invert it to get the original activerecord objects back?