1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activeresource/examples/simple.rb
2009-06-08 20:48:14 -05:00

15 lines
442 B
Ruby

$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
require 'active_resource'
require 'active_support/core_ext/hash/conversions'
ActiveSupport::XmlMini.backend = ENV['XMLMINI'] || 'REXML'
ActiveResource::HttpMock.respond_to do |mock|
mock.get '/people/1.xml', {}, { :id => 1, :name => 'bob' }.to_xml(:root => 'person')
end
class Person < ActiveResource::Base
self.site = 'http://localhost/'
end
bob = Person.find(1)
puts bob.inspect