Assume that you have rest url “http://localhost:3000” that return as xml as below:

Output from http://localhost:300

<tests type="array">
<created-at type="datetime">2009-03-19T08:47:57Z</created-at>
<id type="integer">1</id>
<name>my lab</name>
<updated-at type="datetime">2009-03-25T01:59:10Z</updated-at>
<created-at type="datetime">2009-03-24T08:15:14Z</created-at>
<id type="integer">2</id>
<updated-at type="datetime">2009-03-24T08:15:14Z</updated-at>

Code example

First you need to create one class called Test:

require 'rubygems'

require 'activeresource'

class Test < ActiveResource::Base = "http://localhost:3000"



<strong>And now we call the created Test class</strong>:

T = Test.find(1)

Note: Class Name and XML tag name must be the same without case sensitive.