Created
August 1, 2008 17:30
-
-
Save paul/3643 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 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>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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