aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-05-13 11:55:19 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2009-05-13 12:00:49 -0700
commit4f291fa528e5faad03def69ae7ac98224ab859db (patch)
tree3a9bc62fd9bfb6913b5899f6b86c953d4aa78c1d /activeresource
parente8550ee0329586b32de425e905c7af7e65bc78a8 (diff)
downloadrails-4f291fa528e5faad03def69ae7ac98224ab859db.tar.gz
rails-4f291fa528e5faad03def69ae7ac98224ab859db.tar.bz2
rails-4f291fa528e5faad03def69ae7ac98224ab859db.zip
Simple examples for require profiling
Diffstat (limited to 'activeresource')
-rw-r--r--activeresource/examples/simple.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activeresource/examples/simple.rb b/activeresource/examples/simple.rb
new file mode 100644
index 0000000000..b20ef61670
--- /dev/null
+++ b/activeresource/examples/simple.rb
@@ -0,0 +1,16 @@
+$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
+require 'active_resource'
+require 'active_resource/http_mock'
+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