Skip to content

Instantly share code, notes, and snippets.

@paul
Created August 1, 2008 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paul/3643 to your computer and use it in GitHub Desktop.
Save paul/3643 to your computer and use it in GitHub Desktop.
% ruby test.rb
GET [http://localhost:3000/people]
-> Returned 200 in 0.0567s
[#<Person id=1 name="Paul" created_at=#<DateTime: 212084366581/86400,0,2299161> updated_at=#<DateTime: 212084366581/86400,0,2299161>>]
GET [http://localhost:3000/people/1]
-> Returned 200 in 0.0592s
#<Person id=1 name="Paul" created_at=#<DateTime: 212084366581/86400,0,2299161> updated_at=#<DateTime: 212084366581/86400,0,2299161>>
require 'rubygems'
require 'dm-core'
require 'dm-types'
require 'pathname'
require Pathname(__FILE__).dirname + 'lib/active_resource_adapter'
DataMapper.setup(:default, :adapter => :active_resource, :site => "http://localhost:3000/")
class Person
include DataMapper::Resource
property :id, Integer, :key => true
property :name, String
property :created_at, DateTime
property :updated_at, DateTime
end
people = Person.all
puts people.inspect
person = Person.get(1)
puts person.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment