Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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