Convert XML/JSON reponse to ActiveRecord object

I need to convert the xml/JSON response into an ActiveRecord object.

For example,

<?xml version="1.0" encoding="UTF-8"?> true [email protected] 1 9324405627 9324405627 Haria 1 2009-12-07T07:01:20+05:30

i got the server response as the format of the above XMl/JSON. i wish to
convert this xml to ActiveRecord object as like below

[#<Salesman id: 1, updated_at: “2009-12-07 07:01:20”, name: “Haria”,
mobile: “9324405627”, email: “[email protected]”, stockist_id: 1, active:
true, mdn_number: 9324405627, password: nil>]

I need the above conversion for fetching records easily in the ‘for’
loop
like:

for salesman in salesmen
Name: <%=salesman.name%>
Email: <%=salesman.email%>
end

Please give me a solution as soon as possible?

Thanks

Manivannan J. wrote:

I need to convert the xml/JSON response into an ActiveRecord object.

ActiveResource should be what you’re looking for:

http://www.railsbrain.com/api/rails-2.3.2/doc/index.html?a=C00000606&name=ActiveResource