Skip to content

Instantly share code, notes, and snippets.

@protocarl
Created January 14, 2010 07:05
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 protocarl/276969 to your computer and use it in GitHub Desktop.
Save protocarl/276969 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'dm-core'
class Person
include DataMapper::Resource
property :id, Serial
property :first_name, String
end
DataMapper.setup(:default, 'sqlite3::memory:')
DataMapper.auto_migrate!
person = Person.create(:first_name => 'carl') # => #<Person @id=1 @first_name="carl">
person.first_name.capitalize!
person.first_name # => "Carl"
person.save # => true
person.reload.first_name # => "carl"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment