Skip to content

Instantly share code, notes, and snippets.

@semanticart
Created November 12, 2008 00:50
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 semanticart/24045 to your computer and use it in GitHub Desktop.
Save semanticart/24045 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'dm-core'
require 'dm-is-versioned'
require 'dm-timestamps'
DataMapper.setup(:default, 'mysql://localhost/my_db')
class Article
include DataMapper::Resource
property :id, Integer, :serial => true
property :title, String
property :updated_at, DateTime
is :versioned, :on => :updated_at
end
Article.auto_migrate!
article = Article.create(:title => "Test")
article.title = "Test 2"
article.save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment